日期:2014-05-16  浏览次数:20457 次

ashx接收复杂参数的问题

 [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class shop : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
      
                    
                    // var postData = { f:'buy','list': checkedList, 'name': name, 'addr': addr, 'tel': tel, 'shipping_method': shipping_method, 'comment': comment }

                    string listString = context.Request["list"];

                    

                    string name = context.Request["name"];
                    string addr = context.Request["addr"];


string json = "{ \"success\": true }";
                    context.Response.Write(json);
                    return;
                }

        }



listString 取不到;
addr 和 name可以;
 context.Request.toString()的值是:
 {list%5b0%5d%5bpid%5d=184&list%5b0%5d%5bqty%5d=1&list%5b1%5d%5bpid%5d=185&list%5b1%5d%5bqty%5d=3&f=buy&name=123&addr=123}
------解决方案--------------------
list[0][pid]=184&list[0][qty]=1&list[1][pid]=185&list[1][qty]=3&f=buy&name=123&addr=123

context.Request["list[0][pid]"];