获取post传输参数

1.获取post参数可以用

 传输参数为 a=aa&b=bb这种

public static SortedDictionary<string, string> GetRequestPost() {
            //throw new NotImplementedException();

            int i = 0;
            SortedDictionary<string, string> sArray = new SortedDictionary<string, string>();
            NameValueCollection coll;
            //Load Form variables into NameValueCollection variable.
            coll = HttpContext.Current.Request.Form;

            // Get names of all forms into a string array.
            String[] requestItem = coll.AllKeys;

            for (i = 0; i < requestItem.Length; i++) {
                sArray.Add(requestItem[i], HttpContext.Current.Request.Form[requestItem[i]]);
            }

            return sArray;
        }

接收可以用:SortedDictionary<string, string> sArrary = AA.GetRequestPost();

 

 

链接:https://share.weiyun.com/5sCiWVX

posted @ 2018-08-02 14:12  今晚再打老虎  阅读(1803)  评论(0编辑  收藏  举报