Iis Request.ServerVariables(“登录用户”)返回空

Iis Request.ServerVariables(“登录用户”)返回空,iis,authentication,web-config,authorization,windows-identity,Iis,Authentication,Web Config,Authorization,Windows Identity,Web.config文件 <authentication mode="Windows" /> <authorization> <allow users ="*" /> </authorization> C#代码, welcomeUser.InnerText = Request.ServerVariables.Get("LOGON USER"); 我缺少什么才能显示Windows用户ID?我认为变量是LOGON\u User不是吗

Web.config文件

<authentication mode="Windows" />     

<authorization>
  <allow users ="*" />
</authorization>
C#代码,

welcomeUser.InnerText = Request.ServerVariables.Get("LOGON USER");

我缺少什么才能显示Windows用户ID?

我认为变量是
LOGON\u User
不是吗?(带下划线)请参见


但是,您可能会发现这为您提供了IUSR_MachineName,因此您可能希望查找查找实际登录用户的更好方法,例如
user.Identity.Name
或使用
WindowsIdentity.GetCurrent().Name

是,问题是下划线。非常感谢。
welcomeUser.InnerText = Request.ServerVariables.Get("LOGON USER");