子风.NET 进阶中......

路途多艱,唯勤是岸

 

URL 中文传参数

1.设置web.config文件。
<system.web>
......
<globalization requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN" fileEncoding="gb2312" />
......
</system.web>
 
或者:
aspx文件中:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

2.传递中文之前,将要传递的中文参数进行编码,在接收时再进行解码。
>> 进行传递
string Name = "中文参数";
Response.Redirect("B.aspx?Name="+Server.UrlEncode(Name));

>> 进行接收
string Name = Request.QueryString["Name"];
Response.Write(Server.UrlDecode(Name)); 

posted on 2007-06-08 14:44  子风  阅读(419)  评论(0编辑  收藏  举报

导航