I request a URL as https://user:[email protected]/etcetc
In Controller, I use Request.Url.UserInfo
get nothing, empty string, why?
Or, how can I get user:pass
at controller
Here are a couple of things to check.
1) What does the raw url look like?
2) Validate that the UserInfo property works (which Microsoft says it does, and my tests show it does as well).
Response.Write("Raw: " + Request.RawUrl);
Response.Write("<br />");
Uri uriAddress = new Uri("http://user:[email protected]/index.htm ");
Response.Write("Test URL Results: "+uriAddress.UserInfo);
Based on my own tests I would guess that the user:password portion is being stripped out before it gets to your page. In IE, as others have stated, I was unable to get it to take the values. In Chrome it also seemed to strip them off automatically (after I had typed in the address and hit enter the values disappeared from the address bar immediately).
This may be your issue. IE does not support that by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With