做一些GET或POST 传值一直出现问题。经过一般研究,终于搞定了。
1、设置web.config文件
< system.web >
< globalization requestEncoding ="gb2312" responseEncoding ="gb2312" culture ="zh-CN" fileEncoding ="gb2312" />
</system.web>
一般配置web.config文件可以解决问题。
2、传递中文之前,将要传递的中文参数进行编码,在接收时再进行解码。
>> 进行传递
string Name = "中文参数";
Response.Redirect( "B.aspx?Name="+Server.UrlEncode(Name));
>> 进行接收
string Name = Request.QueryString[ "Name"];
Response.Write(Server.UrlDecode(Name));