public ActionResult Test()
{
var param = GetRequestParam();
Request.InputStream.Position = 0;
var body = new StreamReader(Request.InputStream).ReadToEnd();
logger.Info("notify recieved."
, new KeyValuePair<string, object>("Param", param)
, new KeyValuePair<string, object>("body", body));
return Content("AAAAAA");
}
public SortedDictionary<string, string> GetRequestParam()
{
SortedDictionary<string, string> sArray = new SortedDictionary<string, string>();
NameValueCollection coll;
coll = Request.QueryString;
// Get names of all forms into a string array.
String[] requestItem = coll.AllKeys;
for (int i = 0; i < requestItem.Length; i++)
{
sArray.Add(requestItem[i], Request.QueryString[requestItem[i]]);
}
if (sArray.Keys.Count == 0)
{
sArray = GetRequestPost();
}
return sArray;
}
C# 获取Post过来的所有数据
于 2024-03-04 10:54:47 首次发布