我目前正在研究ASP.NET MVC4網站。 而在那個網站上,我不想讓某個角色的用戶被允許運行代碼。 我使用下面的代碼:ASP.NET IIS用戶角色身份驗證
[Authorize(Roles = GROUP)]
public void Auth()
{
/* if user is in the domain and signed in
* and a member of the above group
* they will come here */
username = User.Identity.Name;
//Do somthing
}
來完成這項工程,但是當用戶不是域和/或組的一部分,它西港島線提示輸入用戶名和密碼。是否可以跳過提示並重定向該用戶?
這個網站是建立在一個IIS 8身份驗證設置爲Windows身份驗證
[Rú? – Neel
是的,在身份驗證設置爲Windows身份驗證的IIS 8中 – Msmit1993