Geeks With Blogs
Nat Luengnaruemitchai Geek Blog
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 Programming | Back to top

Comments on this post: .NET WebBrowser.Url and Uri Misuse

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Nat Luengnaruemitchai | Powered by: