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页面时出现乱码】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论