标签: c# asp.net windows single-sign-on
我在IIS服务器上运行了一个ASP.Net Web应用程序,我需要找到访问者登录用户名。
我怎样才能找到这个?在本地测试时,它使用new WindowsPrincipal(WindowsIdentity.GetCurrent());找到了我的用户名,但在服务器上运行该应用时,它找到 NETWORK SERVICE 。
new WindowsPrincipal(WindowsIdentity.GetCurrent());
答案 0 :(得分:1)
我假设您使用表单身份验证。尝试:
User.Identity.Name