Hello,
I am trying to create a Webrequest. The used Uri is something like
"http://us******@domain.com:pa******@www.shfgshfge.com".
Note that the username contains an "@"-character.
I tried two ways. Neither does work.
1. Directly creating an Uri:
Uri u=new Uri("http://us******@domain.com:pa******@www.shfgshfge.com");
It fails with an System.UriFormatException (Something like "The hostname
cannot be parsed.")
2. Using an UriBuilder:
UriBuilder ub=new UriBuilder();
ub.Host="www.shfgshfge.com";
ub.Scheme="http";
ub.Path="/";
ub.Username="us******@domain.com";
ub.Password="password";
Uri u=ub.Uri;
It fails with the above error.
Unfortunately, the UserInfo property of Uri is readonly.
How can I generate a valid Uri from this string and subsequently use it in a
WebRequest?
TIA