ASP.NET传递中文参数乱码的解决方法
方法1:
web.config里修改
<globalization requestEncoding="GB2312" resp />
方法2:
传送时要将要传送的中文字符用Server.UrlEncode方法编码,
接收时使用Server.UrlDecode来解码.
例子:
Response.Write("<script>window.open('allpage1.aspx?date=" + Calendar1.SelectedDate.ToString("yyyy/MM/dd") + " 23:59:59&bm=" + Server.UrlEncode(DropDownList2.SelectedValue.Trim()) + "','test','resizable=yes,status=yes,toolbar=no,menubar=no,location=no');</script>");
web.config里修改
<globalization requestEncoding="GB2312" resp />
方法2:
传送时要将要传送的中文字符用Server.UrlEncode方法编码,
接收时使用Server.UrlDecode来解码.
例子:
Response.Write("<script>window.open('allpage1.aspx?date=" + Calendar1.SelectedDate.ToString("yyyy/MM/dd") + " 23:59:59&bm=" + Server.UrlEncode(DropDownList2.SelectedValue.Trim())