url传递中文的方法

传递中文之前,将要传递的中文参数进行编码,在接收时再进行解码。 
传递时编码:

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"]);

posted on 2007-08-14 22:57  kyovcs  阅读(374)  评论(0编辑  收藏  举报

导航