【发布时间】:2014-05-09 11:23:15
【问题描述】:
此项目使用 System.Security.Principal.WindowsIdentity 进行身份验证
我看过这个: Can't get HttpContext.Current.User.Identity to work in my WebMatrix project
IIdentity WinId = HttpContext.Current.User.Identity;//returns no data
WindowsIdentity wi = (WindowsIdentity)WinId;
我在我的 Web.config 中禁用了匿名
<authorization>
<deny users="?" />
</authorization>
奇怪的是我有另一个项目,它使用相同的代码并且具有相同的 .config 但可以工作,
【问题讨论】:
-
您是否在 IIS 上安装了 Windows 身份验证角色服务? iis.net/configreference/system.webserver/security/…
-
您是在同一个域还是不同域上运行您的应用程序?
-
是的,它已启用,无论如何 - 相同的结果
标签: c# asp.net httpcontext windows-identity