Roll based login

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vjainpee
    New Member
    • Apr 2008
    • 9

    Roll based login

    Hi All,
    I m new to asp.net

    I want to make a login page in which login will be roll based ,ie. if A logs in he will be redirected to some other page and if B logs in he will be redirected to some other page
    Is there any simple method to do this or I have to write these conditions in code.

    Please Help
    Thanks in advance
  • abev
    New Member
    • Jan 2008
    • 22

    #2
    If you use the build in Login control of asp.net it's pretty simple. Put this in the Loggedin event of the login control. You could easily use a Select...Case or simple If..Then if you wish.

    Code:
            'redirect user based on the role
            If Roles.IsUserInRole("LeagueAdministrator") Then
                Response.Redirect("~/users/AccountHome.aspx")
            ElseIf Roles.IsUserInRole("LeagueOfficial") Then
                Response.Redirect("~/users/AccountHome.aspx")
            ElseIf Roles.IsUserInRole("SiteAdministrator") Then
                Response.Redirect("~/users/AccountHome.aspx")
            Else
               'other stuff
            End If

    Comment

    Working...