解決Jquery Ajax提交 伺服器端接收中文亂碼問題

浪花一朵朵發表於2013-08-30

看到有朋友說到用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());
            }

 

相關文章