ASP.NET url传递中文的方法

来源:互联网 发布:rust值得购买知乎 编辑:程序博客网 时间:2024/05/16 01:26

传递中文之前,将要传递的中文参数进行编码,在接收时再进行解码。  m‡‹fP>Y…bbs.szblogs.comÅ$Zý-•Q#Õÿ
传递时编码:

string keyword=this.txtSeek.Text.Trim();

this.Response.Redirect("~/product/product_list.aspx?keyword="+Server.UrlEncode(keyword));

 

 

 

 

 

 

如果此时传递的是中文"",则地址栏显示:

product/product_list.aspx?keyword=%e6%88%91

接收时解码:

string keyword=Server.UrlDecode(Request.QueryString["KeyWord"]);

原创粉丝点击