我有一个非常简单的方法,我正在调用Page load,它看起来像这样
Protected Sub identify()
If User.Identity.IsAuthenticated Then
Else
Response.Redirect("login.aspx")
End If
End Sub
我想要做的是根据用户所属的角色组抛出重定向。因此,如果他们经过身份验证,但不是“管理员”用户组的一部分,我会将其重定向到其他页面....类似
Protected Sub identify()
If User.Identity.IsAuthenticated Then
If user.Identiy.IsInRoleGroup("Admin")
Response.Redirect("AdministratorDefault.aspx")
End If
Else
Response.Redirect("login.aspx")
End If
End Sub
这样的事情可能吗?我找不到答案。
答案 0 :(得分:0)
If (User.IsInRole("Administrator"))
...
End If
http://msdn.microsoft.com/en-us/library/system.security.principal.windowsprincipal.isinrole.aspx