Hi.
I've noticed, after moving some of our code to 2.0, that
System.Net.WebR equest.Create(S ystem.String) and
System.Uri(Syst em.String) no longer behave as they did in 1.1
framework.
Example:
string emailHttpPath =
"http://myexchange.mydo main.com/exchange/mymailboxalias/inbox/mysubfolder./;
// Notice the punctutation in the end, which is a legal web folder
name.
HttpWebRequest webRequest =
(HttpWebRequest )WebRequest.Cre ate(emailHttpPa th);
// Do stuff with the webrequest...
// This fails with a 404 error in 2.0 framework, but succeeds in 1.1
framework
HttpWebResponse webResponse =
(HttpWebRespons e)webRequest.Ge tResponse();
The reason the above code fails, is that when
WebRequest.Crea te(System.Strin g) 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.Crea te(System.Strin g) 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.