System.Uri bug??
-
I have the following URL: http://citeseer.ist.psu.edu/rd/55811103,653,1,0.25,Download/http://citeseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf Creating System.Uri with the above URL: Uri uri = new Uri(aboveURL) removes the extra slash after "Download/http://". The debugger shows it as Download/http:/citeseer.ist.... The Uri in HttpWebRequest (which is created with the above URL) also removes the extra slash. As a result, I get NameResolution exception. The Uri is shown as http://citeseer.ist.psu.edu/rd/55811103,653,1,0.25,Download/http:/citeseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf
-
I have the following URL: http://citeseer.ist.psu.edu/rd/55811103,653,1,0.25,Download/http://citeseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf Creating System.Uri with the above URL: Uri uri = new Uri(aboveURL) removes the extra slash after "Download/http://". The debugger shows it as Download/http:/citeseer.ist.... The Uri in HttpWebRequest (which is created with the above URL) also removes the extra slash. As a result, I get NameResolution exception. The Uri is shown as http://citeseer.ist.psu.edu/rd/55811103,653,1,0.25,Download/http:/citeseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf
You could try using the UrlEncode/UrlDecode functions in the HttpUtility class.
-
You could try using the UrlEncode/UrlDecode functions in the HttpUtility class.
Using HttpUtility.Encode results in System.Uri throwing an exception, since it can't process the encoded info. Uri uri = new Uri(HttpUtility.UrlEncode(url));