我有一行代码:
Label.Text="<A href='answer.aspx?id="+Server.UrlEncode("我的电脑--外星人")+"'>请点击</A>"
当我单击按钮时出现http://localhost/answer.aspx?id=%e6%88%91%e7%9a%84%e7%94%b5%e8%84%91--%e5%a4%96%e6%98%9f%e4%ba%ba
在answer.aspx页面在用Request.Params["id"]接收不下来参数,还有就是如何把那些乱码还原出来。
救命啦!!
Label.Text="<A href='answer.aspx?id="+Server.UrlEncode("我的电脑--外星人")+"'>请点击</A>"
当我单击按钮时出现http://localhost/answer.aspx?id=%e6%88%91%e7%9a%84%e7%94%b5%e8%84%91--%e5%a4%96%e6%98%9f%e4%ba%ba
在answer.aspx页面在用Request.Params["id"]接收不下来参数,还有就是如何把那些乱码还原出来。
救命啦!!
Request.QueryString["id"]
Request.QueryString["id"]
另外两位老兄也试过,没有任何变化
还是谢谢你们,有没有做过的,把代码传上来参考一下
<globalization
requestEncoding="GB2312"
responseEncoding="GB2312"
/>
改为:
<globalization
requestEncoding="UTF-8"
responseEncoding="UTF-8"
/>
在试试
是不是Request.QueryString["id"]没有接收到参数?
HttpUtility.UrlEncode 方法
后解码。
HttpUtility.UrlDecode 方法
你的分析是有道理的,先看看Request.QueryString["id"]这个是否可以接收到数据,this.Response.Write(Request.QueryString["id"].Tostring());看看有没有什么东西,从前我也遇到过这样的问题,不过
Server.UrlEncode()
Server.UrlDecode()
也就好了。你再查查吧,