好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

asp.net中在用ajax格式传递数据到aspx页面时出现乱码

 asp.net中在用ajax格式传递数据到aspx页面时有时会出现乱码,以下为解决方法

js中 :
代码如下:

XmlHttp.open("POST", "test.aspx", false);
XmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
XmlHttp.send("QueryName=" + escape(Queryname) + "&QuerySex=" +escape(Querysex));

在test.aspx中 :
代码如下:

string QueryName = HttpUtility.UrlDecode(Request.Params["QueryName"]);
string QuerySex = HttpUtility.UrlDecode(Request.Params["QuerySex"]);

查看更多关于asp.net中在用ajax格式传递数据到aspx页面时出现乱码的详细内容...

  阅读:43次