[英]Can I get a users identity from an email address instead of a username in ASP.NET Core and DirectoryServices?
[英]How can I find the users windows login username from ASP.Net?
我有一个运行在IIS服务器上的ASP.Net Web应用程序,我需要找到访问者的登录用户名。
我怎么能找到这个? 在本地测试时,它使用new WindowsPrincipal(WindowsIdentity.GetCurrent());
找到了我的用户名new WindowsPrincipal(WindowsIdentity.GetCurrent());
,但在服务器上运行该应用程序时会找到“ 网络服务 ”。
我假设您使用表单身份验证。 尝试:
User.Identity.Name
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.