.net接收post请求并把数据转为字典格式
程序员文章站
2022-06-18 16:01:06
public SortedDictionary GetRequestPost() { int i = 0; SortedDictionary sArray = new SortedDictionary() ......
public sorteddictionary<string, string> getrequestpost()
{
int i = 0;
sorteddictionary<string, string> sarray = new sorteddictionary<string, string>();
namevaluecollection coll = request.form;
string[] requestitem = coll.allkeys;
for (i = 0; i < requestitem.length; i++)
{
sarray.add(requestitem[i], request.form[requestitem[i]]);
}
coll.clear();
return sarray;
}
调用:
sorteddictionary<string, string> spara = getrequestpost();