Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request.Url.UserInfo No Value

Tags:

c#

request

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

like image 708
Eric Yin Avatar asked May 30 '12 01:05

Eric Yin


2 Answers

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).

like image 191
Peter Avatar answered Oct 10 '22 00:10

Peter


This may be your issue. IE does not support that by default.

like image 31
Otávio Décio Avatar answered Oct 09 '22 22:10

Otávio Décio