开发者

How to get user name and password from url in ASP.NET?

开发者 https://www.devze.com 2023-01-07 16:48 出处:网络
How can get in ASP.NET user name and password from URL? 开发者_如何学Pythonhttps://myUser:myPassword@myServer/

How can get in ASP.NET user name and password from URL?

开发者_如何学Pythonhttps://myUser:myPassword@myServer/

HttpContext.Current.Request.Url is returning https://myServer/.


You need to access the authentication headers.

Info about HTTP Authentication: http://en.wikipedia.org/wiki/Basic_access_authentication

Implementing it in asp.net: http://blog.smithfamily.dk/2008/08/27/ImplementingBasicAuthenticationInASPNET20.aspx


Actually, it's perfectly possible to have URI credentials in the URL without a HTTP Authorization header. To pull those out, since the Request.Url property is a Uri object, you can access those details in the Uri.UserInfo property.

0

精彩评论

暂无评论...
验证码 换一张
取 消