欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

.net接收post请求并把数据转为字典格式

程序员文章站 2022-03-04 12:03:33
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();