开发者

How can I find the users windows login username from ASP.Net?

开发者 https://www.devze.com 2023-01-21 12:07 出处:网络
I have an ASP.Net web application 开发者_运维知识库running on an IIS server, and I need to find the visitors login username.

I have an ASP.Net web application 开发者_运维知识库running on an IIS server, and I need to find the visitors login username.

How can I can find this? When testing locally it found my username using new WindowsPrincipal(WindowsIdentity.GetCurrent());, but it finds NETWORK SERVICE when running the app on the server.


I assume you use forms authentication. Try:

User.Identity.Name
0

精彩评论

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