Hi.
I've noticed, after moving some of our code to 2.0, that
System.Net.WebRequest.Create(System.String) and
System.Uri(System.String) no longer behave as they did in 1.1
framework.
Example:
string emailHttpPath =
"http://myexchange.mydomain.com/exchange/mymailboxalias/inbox/mysubfolder./;
// Notice the punctutation in the end, which is a legal web folder
name.
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(emailHttpPath);
// Do stuff with the webrequest...
// This fails with a 404 error in 2.0 framework, but succeeds in 1.1
framework
HttpWebResponse webResponse =
(HttpWebResponse)webRequest.GetResponse();
The reason the above code fails, is that when
WebRequest.Create(System.String) is called, it removes the punctuation
from the httpPath making it look like this:
http://myexchange.mydomain.com/excha...x/mysubfolder/
WITHOUT the punctuation.
The url without the trailing punctuation correctly doesn't exist, so
the error it self is perfectly correct. However, I can't see how the
parsing of the url can be correct.
The same thing also applies for the System.Uri class. I tried
instantiating a System.Uri object with the above string http path, and
it also removes the trailing punctuation. I'm guessing
WebRequest.Create(System.String) internally puts a System.Uri on top of
the string http path.
What to do here?
I found this information about changes in System.Uri:
http://msdn.microsoft.com/netframewo...ce.aspx#System
Which seems to suggest that System.Uri always escapes urls. In the
above case, it seems however, that it doesn't escape correctly.