System.Uri can't parse when password field contains a "#"
- by Andrew
The following code throws System.UriFormatException:
var uri = new UriBuilder("ftp://user:pass#[email protected]:21/fu/bar.zip");
System.UriFormatException: Invalid URI: A port was expected because of there is a colon (':') present but the port could not be parsed.
Removing the # symbol from the password field solves the issue.
Is a # symbol a valid character to have in the password field?
Is there a way to escape this?
Is this a known bug in the parsing routine of the Uri class?
How does one get around this - assuming you can't change the password? ;-)
Thanks, Andrew