Skip to content Skip to sidebar Skip to footer

Server.UrlEncode Apostrophe(') In Firefox

So I have a Hyperlink called lnkTwitter: And I'm trying to set the url in the code behind: lnkTwitter.NavigateUrl = string.Format('http://www.twitter.com/home?status={0}', Server.U

Solution 1:

Have you tried to view source code? If source is ok, then there's no troubles with your code.


Solution 2:

Firefox just likes to unescape the urls that it shows. While this can be confusing it should not cause your code or the sites you link to (twitter, in this case) any problems.

If you follow the link and then copy the url and paste it into Notepad or something then you should get the escaped form that was actually used instead of the unescaped form that was displayed.


Solution 3:

Uri.EscapeDataString, Uri.EscapeUriString, HttpUtility.UrlEncode and HttpUtility.UrlPathEncode are available to use in C# out of the box, they can not convert all the characters exactly the same way as JavaScript escape function does.

Answer : Use JScript.Net's own implementation. Simply reference the Microsoft.JScript.dll and use the Microsoft.JScript.GlobalObject.escape() method to encode your url.


Post a Comment for "Server.UrlEncode Apostrophe(') In Firefox"