2018-01-15 C# ashx 获取post参数

2018-01-15  本文已影响162人  我是Mr小赵先生
System.Collections.Specialized.NameValueCollection coll = context.Request.Form;
                String[] requestItem = coll.AllKeys;
                Dictionary<string, string> sArray = new Dictionary<string, string>();
                int i = 0;
                for (i = 0; i < requestItem.Length; i++)
                {
                    sArray.Add(requestItem[i], context.Request.Form[requestItem[i]]);
                }

将post过来的参数放入到sArray 字典中,通过sArray["key"]的方式获取具体的参数值。

上一篇下一篇

猜你喜欢

热点阅读