2012-11-01 76 views
0

我有一個非常簡單的方法,我號召頁面加載用戶,它看起來像這樣重定向基於Rolegroup

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

可以使用'User.IsInRole()'http://msdn.microsoft.com/en-us/library/system.security.principal.windowsprincipal.isinrole。 aspx – JonH

回答