【发布时间】:2017-03-13 19:07:41
【问题描述】:
我继承了 MVC4 应用程序。看起来使用了 Windows 身份验证,但我也被告知“Active Directory 身份验证”用于某些权限。我在 web.config 中没有看到任何关于 Active Directory 的内容。 在 web.config 中:
<authentication mode="Windows" />
<roleManager defaultProvider="DefaultRoleProvider">
<providers>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=21bf1234ad634e53" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</roleManager>
在控制器中:
[Authorize(Roles = @"ABCD\EFG"), HandleError(ExceptionType = typeof(UnauthorizedAccessException), View = "UnauthorizedUser", Order = 1)]
public class HomeController : Controller
{ .............
}
public ActionResult MyAction()
{
if (!User.IsInRole(@"ABCD\EFG"))
{
// some code
}
//.............
}
此应用程序中是否使用了“Active Directory 身份验证”?
谢谢
【问题讨论】:
标签: asp.net-mvc-4 active-directory windows-authentication