解决Jquery Ajax提交 服务器端接收中文乱码问题
看到有朋友说到用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()); }
作者:逐帆
出处:http://www.cnblogs.com/langhua/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。