【发布时间】:2014-03-28 08:33:56
【问题描述】:
将其写为问题并自行回答,因为我遵循了两个步骤来解决问题,而这两个步骤不能一起使用。
正在使用 Visual Studio 2012 在 ASP.Net MVC 4 [使用剃刀视图的互联网应用程序] 中开发应用程序。
<authentication> 的默认 web.config 条目如下:
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
我需要对应用程序进行 Windows 身份验证。因此,将模式更改为 Windows
<authentication mode="Windows" />
通过上述设置,HttpContext.User.Identity.IsAuthenticated 为 false HttpContext.User.Identity.Name 为空字符串。
【问题讨论】:
-
好的,您是否在网络服务器上设置了 NTLM 身份验证?
-
@DavidHirst :已发布步骤作为使其在本地运行的答案。未在网络服务器上设置 NTLM 身份验证。需要以下过程才能使应用程序在本地以调试模式运行。
标签: c# asp.net-mvc asp.net-mvc-4 windows-authentication