Url传值编码UrlEncode和解码UrlDecode

url传汉字出现乱码

解决办法对汉字进行编码和解码 

页面1

Response.Redirect("Default2.aspx?para1="+HttpUtility.UrlEncode("中国你好数据")+"&para2=数据的方式的"); 

 

页面2

this.Label1.Text = Request["para2"].ToString();   //没有解码操作

this.Label2.Text = System.Web.HttpUtility.UrlDecode(Request["para1"].ToString());   //解码操作

posted on 2012-11-21 17:17  jameshappy  阅读(617)  评论(0编辑  收藏  举报