Link to home
Start Free TrialLog in
Avatar of rrhandle8
rrhandle8Flag for United States of America

asked on

How to find user role with IdentityHelper, then redirect

How do I find the role the user belongs to then redirect to a page in the Admin folder if they belong to the Admin role.


    Protected Sub LogIn(sender As Object, e As EventArgs)
        If IsValid Then
            ' Validate the user password
            Dim manager = New UserManager()
            Dim user As ApplicationUser = manager.Find(UserName.Text, Password.Text)
            If user IsNot Nothing Then
                IdentityHelper.SignIn(manager, user, RememberMe.Checked)
                IdentityHelper.RedirectToReturnUrl(Request.QueryString("ReturnUrl"), Response)
            End If
        Else
            FailureText.Text = "Invalid username or password."
            ErrorMessage.Visible = True
        End If
        End If
    End Sub

Open in new window

Avatar of Naitik Gamit
Naitik Gamit
Flag of India image

ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial