我继承了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身份验证“?
谢谢
发布于 2017-03-14 11:23:36
只要应用程序服务器位于用户注册的域中,windows身份验证就确实会与Active Directory集成。
配置文件中的以下行启用了此类功能。
<authentication mode="Windows" />这篇文章可能会帮助你走得更远:Configure ASP.NET MVC for authentication against AD
https://stackoverflow.com/questions/42771563
复制相似问题