解决Jquery Ajax提交 服务器端接收中文乱码问题

时间:2022-08-26 13:04:52

看到有朋友说到用post提交方式解决,我指定了methord="post",仍然解决不了,

说一下解决办法,客户端进行编码,服务器端解码,

客户端:var where = escape($('#where').val());

服务器端:

        public void ProcessRequest(HttpContext context)
        {
            context.Response.Buffer = true;
            context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
            context.Response.AddHeader("pragma", "no-cache");
            context.Response.AddHeader("cache-control", "");
            context.Response.CacheControl = "no-cache";
            context.Response.ContentType = "text/plain";
            //context1 = context;
            Request = context.Request;
            Response = context.Response;
            Session = context.Session;
            Server = context.Server;
            loginUser = ClientData.GetLogonUser(this.Request);
            string method = Request["action"].ToString();
            System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(method);
            methodInfo.Invoke(this, null);
        }

 

if (Request["where"] != null)
            {
                strWhere = Server.UrlDecode(Request["where"].ToString());
            }