Nat Luengnaruemitchai

Geek Blog

  Home  |   Contact  |   Syndication    |   Login
  99 Posts | 0 Stories | 212 Comments | 236 Trackbacks

News

Archives

Post Categories

Blogroll

Many times, people use Uri.ToString() to convert Uri back into String. However, based on the documentation, ToString() actually returns the canonical string representation of the actual URL. This means the special characters that were previously escaped will be unescaped. If you try to use a string that returns from the function, it will be ok in most case except when you have escaped characters in there such as "%20" (" "), "%2b" ("+"), "%25 ("%"), etc. To make the code works right, you should actually use Uri.AbsoluteUri to return back the right representation of the URL itself. I found that WebBrowser.Url actually uses Uri.ToString() which prohibits users to pass in escaped characters as parts of URL. I hope that one day, it will be fixed.... hopefully in .NET 3.0?
posted on Tuesday, October 24, 2006 11:05 PM