我正在尝试使用HttpContext.Current.User.Identity.Name从内部网络获取用户的 Windows登录详细信息,但它是空的.

我已经尝试在Web.Config中更改身份验证模式,但没有任何乐趣:

<system.web>
    <authentication mode="Windows" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>

我还听说在项目属性中你应该启用Windows身份验证并禁用匿名身份验证,如下所示:

但后来我得到了一个重定向循环,在Chrome中显示“此网页有重定向循环”的消息.

我还检查过我的机器上安装了Windows身份验证:

有关如何解决此问题的任何想法吗?

非常感谢

当我有:

<authentication mode="Windows"/>
<identity impersonate="true/>

在web.config中我得到当前用户:

string currUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
本站提供的所有下载资源均来自互联网,仅提供学习交流使用,版权归原作者所有。如需商业使用,请联系原作者获得授权。 如您发现有涉嫌侵权的内容,请联系我们 邮箱:alixiixcom@163.com