日期:2014-05-18  浏览次数:20417 次

url传递参数乱码问题
页面a.htm:
<a href="b.aspx?p=str like ''%aaaaaaaa%''">test</a>

页面b.aspx:
Response.Write(Server.UrlEncode(Request.QueryString["p"]));
出现乱码,不加Server.UrlEncode,或者a页面中用js的escape也都一样,望高人指点一二啊

------解决方案--------------------
b页面应该是解码吧?咋整成编码了?

页面b.aspx: 
Response.Write(Server.UrlDecode(Request.QueryString["p"])); 

------解决方案--------------------
看是不是 页面编码问题啊
在webconfig中加上
<system.web>

<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>

</system.web>
------解决方案--------------------
a.htm要编码吧

<a href="<%=Server.UrlEncode("b.aspx?p=str like ''%aaaaaaaa%''")%>">test </a>