Uri test = new Uri("http%3A%2F%2F100.100.1.1%3A8080");
An unhandled exception of type 'System.UriFormatException' occurred in System.开发者_C百科dll
Additional information: Invalid URI: The format of the URI could not be determined.
Anyone know why I cannot pass in a URL encoded string to the constructor of Uri?
Do not escape it and try using http://100.100.1.1:8080.
The Uri Constructor requires the String to be a valid RFC2396 URI. There's this Uri.CheckSchemeName Method to check if your passed URI is valid.
Are you missing a %
before the second 2F
? Try passing the string through a URL un-encoder and make sure the result is what you expected.
精彩评论