[英]MVC4 Forms Authentication Active Directory Custom Authorize Attribute
[英]MVC 5 app with Active Directory authentication failing Authorize attribute
我有一個MVC 5 Web應用程序,該應用程序被設置為根據此鏈接使用表單身份驗證
它已成功針對LDAP進行了驗證(即,對Membership.ValidateUser(model.UserName, model.RememberMe)
的調用返回true),但是當它重定向到HomeController的Index操作時,它擊中了[Authorize]
屬性並認為用戶由於某種原因未獲得授權,因此它將再次重定向到登錄頁面。
我在這里想念什么?
您需要將身份驗證cookie添加到響應中,如下所示:
FormsAuthentication.SetAuthCookie((model.UserName, model.RememberMe)
或者您也可以按照此鏈接中所述手動進行操作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.