C# 无法获取HttpContext.Current.User.Identity以返回值

C# 无法获取HttpContext.Current.User.Identity以返回值,c#,asp.net,httpcontext,windows-identity,C#,Asp.net,Httpcontext,Windows Identity,此项目使用System.Security.Principal.WindowsIdentity进行身份验证 我看了一下: 我已在我的Web.config中禁用匿名 wierd部分是我有另一个项目,它使用相同的代码,有相同的.config,但是可以工作,你在你的web配置中写过这个吗 <authentication mode="Windows"/> 您是否在IIS上安装了Windows身份验证角色服务?您是否在同一个域或不同的域上运行应用程序?是的,它已启用,无论-与我的结果相

此项目使用System.Security.Principal.WindowsIdentity进行身份验证

我看了一下:

我已在我的Web.config中禁用匿名



wierd部分是我有另一个项目,它使用相同的代码,有相同的.config,但是可以工作,

你在你的web配置中写过这个吗

<authentication mode="Windows"/>

您是否在IIS上安装了Windows身份验证角色服务?您是否在同一个域或不同的域上运行应用程序?是的,它已启用,无论-与我的结果相同,我无法使用System.Environment.UserName,因为这是一个intranet应用程序
  <authorization>
    <deny users="?" />
  </authorization> 
<authentication mode="Windows"/>