using System.Collections.Specialized;
LogHelper.GetInstance().WriteMessage("==============================================================================start");
NameValueCollection nvc = Request.Form;
NameValueCollection nvc1 = Request.Params;
//Params可以获取这三个集合的参数,不过一般不这么用,这个集合比较大,性能不好。所有我们平时都用具体的,要么Form,要么QueryString
//获取 System.Web.HttpRequest.QueryString、
//System.Web.HttpRequest.Form、
//System.Web.HttpRequest.ServerVariables
string[] keys = nvc.AllKeys;
if (keys == null || keys.Length <= 0)
{
LogHelper.GetInstance().WriteMessage("Request.Form参数Length为0");
}
foreach (string k in keys)
{
string key = k;
string value = Request.Form[k];
LogHelper.GetInstance().WriteMessage(string.Format("Request From key:{0},{2},Value:{1}{2}",key,value,Environment.NewLine));//加个换行符
}
LogHelper.GetInstance().WriteMessage("==============================================================================end");
原文地址:https://www.cnblogs.com/zttb/p/9300416.html