0
我已經繼承了MVC4應用程序。它看起來像使用Windows身份驗證,但我也被告知「Active Directory身份驗證」用於某些權限。我在web.config中看不到有關Active Directory的任何內容。 在web.config中:是否使用Active Directory身份驗證?
<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驗證」?
謝謝
謝謝StfBln,我看到後你推薦的,有什麼讓我感到困惑的是,「匿名身份驗證」在我的情況與WA一起啓用,並沒有使用'..deny ..'語句。看來使用WA可能比那篇文章簡單得多? –
我的意思是WA和AD –