开发者

How to stop automatic url decode in Firefox & Safari?

in my web application i want to transmit some values through the url between pages. Because i have some special characters i decided to encode my values in order not to break my urls. in IE and Opera when i load my urls in a browser they stay encoded but in Safari and Firefox the urls are automatically decoded and my code breaks.

in IE8 & Opera an encoded value looks like in the url Default.aspx?sid=%c5%a1D%19%5c%c2%a5) and is not automatically dec开发者_运维技巧oded.

in Firefox & Safari the value is automatically decoded and appears "in clear" like this Default.aspx?sid=šD\¥)

the problem is that when i call HttpUtility.UrlDecode(Request.QueryString["sid"]) in my code and the webpage is opened in Firefox or Safari my code breaks...any idea how to stop the autodecoding?


You shouldn't be calling HttpUtility.UrlDecode(Request.QueryString["sid"]). Use directly Request.QueryString["sid"] and leave ASP.NET handle the decoding if necessary.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜