Request.Url.UserInfo没有价值

Eri*_*Yin 6 c# request

我请求一个URL作为 https://user:pass@domain.com/etcetc

在Controller中,我使用Request.Url.UserInfoget nothing,空字符串,为什么?或者,我怎样才能获得user:pass控制器

Pet*_*ter 3

这里有一些需要检查的事情。

1)原始网址是什么样的?
2) 验证 UserInfo 属性是否有效(微软说它有效,我的测试表明它也有效)。

    Response.Write("Raw: " + Request.RawUrl);
    Response.Write("<br />");

    Uri uriAddress = new Uri("http://user:password@www.contoso.com/index.htm ");
    Response.Write("Test URL Results: "+uriAddress.UserInfo);
Run Code Online (Sandbox Code Playgroud)

根据我自己的测试,我猜测用户:密码部分在到达您的页面之前已被删除。在 IE 中,正如其他人所说,我无法让它获取这些值。在 Chrome 中,它似乎也会自动剥离它们(在我输入地址并按 Enter 键后,值立即从地址栏中消失)。