【发布时间】:2017-03-01 20:14:32
【问题描述】:
我正在为我的组织构建一个 ASP.NET MVC Intranet 应用程序并想要获取网络用户名。我的 Web.config 中有以下内容
<system.web>
<authentication mode="Windows"> </authentication>
<authorization>
<allow users="*"/>
<deny users="?"/>
</authorization>
当我使用 IIS Express 进行调试时,Request.LogonUserIdentity.Name 提供了我的 Windows 用户名。
但是,当在 IIS 上部署我的应用程序时,Request.LogonUserIdentity.Name 将以 "NT AUTHORITY\IUSR" 的形式出现,而不是 Windows 用户名。
在 IIS 中,对于我的应用程序,我只启用了 Windows 身份验证并禁用了其他类型的身份验证。
我需要在 IIS 中进行哪些更改,以便Request.LogonUserIdentity.Name 提供登录的 Windows 用户名?
【问题讨论】:
-
如果你删除了允许元素会发生什么?
标签: asp.net asp.net-mvc iis windows-authentication