asp.net URL传值中文乱码

1.webconfig   添加如下代码

 <system.web>

          <globalization requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN" fileEncoding="gb2312" />

 </system.web>

 

2.编码 JS对中文进行编码处理    escape() 方法

 例如:"DialogFrame.htm?dialogTitle="+escape("要传递的中文") ;

 

3.解码:

后台接收解码处理    Server.UrlDecode()  方法

string titile = Request.QueryString["dialogTitle"];
ltltitle.Text = Server.UrlDecode(titile);

前台解码var dialogTitle = GetQueryValue("dialogTitle")

                 unescape(dialogTitle) 

posted @ 2015-09-10 15:28  rglong  阅读(197)  评论(0)    收藏  举报