Before .Net 4.5, it seems that System.Uri would unencode encoded slashes, but this has since been fixed. Reference: https://stackoverflow.com/a/20733619/188740
I'm encountering the same problem with colons. System.Uri still unencodes encoded colons. Example:
var uri = new Uri("http://www.example.com/?foo=http%3A%2F%2Fwww.example.com");
var s = uri.ToString(); //http://www.example.com/?foo=http:%2F%2Fwww.example.com
Notice how %3A
gets switched back to :
by System.Uri. Is this a bug? What's the best workaround?