报错:
url传值时出现乱码的原因:传递的参数有中文
解决办法有多种:
第一种:传递中文之前,将要传递的中文参数进行编码,在接收时再进行解码。(这种试过,可行)
进行传递
string Name = "中文参数";
Response.Redirect("B.aspx?Name="+Server.UrlEncode(Name)) ;
进行接收
string Name = Request.QueryString["Name"];
Response.Write(Server.UrlDecode(Name)) ;
结果如下:
第二种:这种没有试过
1.设置web.config文件
<system.web>
......
<globalization requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN" fileEncoding="gb2312" />
......
</system.web>