Can I stop Uri from unencoding a url in WebRequest.Create?

Posted by Paul on Stack Overflow See other posts from Stack Overflow or by Paul
Published on 2012-09-17T15:35:56Z Indexed on 2012/09/17 15:37 UTC
Read the original article Hit count: 231

Filed under:

The code itself isn't complex, it's just not working properly:

Uri uri = new Uri("https://www.google.com/webmasters/tools/feeds/sites/http%3A%2F%2Fwww.mydomain.co.uk%2F"); WebRequest.Create(uri);

I get a "Bad Request" back from the server, and after much MUCH digging, discovered that the uri is being turned in to "https://www.google.com/webmasters/tools/feeds/sites/http%3A//www.mydomain.co.uk/" which is not what I asked for, and so it's having a whinge

Is there a way to stop this?

© Stack Overflow or respective owner

Related posts about c#