asp.net遍历request.form 值

2019-2-19


for (int i = 0; i < Request.Form.Count; i++) {

if (Request.Form.Keys[i].ToString().Substring(0,1)!="_")

Response.Write(Request.Form.Keys[i].ToString() + " = " + Request.Form[i].ToString());

}

for(int i = 0;i<Request.Params.Count;i++)
Response.Write("<li>" + Request.Params.Keys[i].ToString() + " = " + Request.Params[i].ToString());

Response.Write("<hr>");
for(int i = 0;i<Request.Form.Count;i++)
Response.Write("<li>" + Request.Form.Keys[i].ToString() + " = " + Request.Form[i].ToString());

Response.Write("<hr>");
for(int i = 0;i<Request.QueryString.Count;i++)
Response.Write("<li>" + Request.QueryString.Keys[i].ToString() + " = " + Request.QueryString[i].ToString());

Response.Write("<hr>");
for(int i = 0;i<Request.Cookies.Count;i++)
Response.Write("<li>" + Request.Cookies.Keys[i].ToString() + " = " + Request.Cookies[i].ToString());