我目前正在研究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