Login control and redirect depends on ROLE

Posted on 2006-04-25
Last Modified: 2008-02-01
Hi experts

How can i redirect user depends on role he belong?

        If (Membership.ValidateUser(Login1.UserName, Login1.Password)) Then
            Dim r() As String = Roles.GetRolesForUser(Login1.UserName)
            For i As Byte = 0 To r.Length
                Select Case r(i).ToUpper
                    Case "ABC"
                    Case "DEF"
                    Case "GHI"
                    Case "JKL"
                End Select
        End If

the code works but i cannot redirect the user, it's like web.config is missing something :

  <authentication mode="Forms">
   <forms name=".COOK" />
  <sessionState mode="InProc" cookieless="false" timeout="30"></sessionState>  
            <roleManager enabled="true">
    <remove name="AspNetSqlRoleProvider" />
    <add connectionStringName="SMS_ManConnectionString" applicationName="/"
     name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <remove name="AspNetSqlMembershipProvider" />
    <add connectionStringName="SMS_ManConnectionString" enablePasswordRetrieval="true"
     enablePasswordReset="true" requiresQuestionAndAnswer="false"
     applicationName="/" requiresUniqueEmail="true" passwordFormat="Encrypted"
     maxInvalidPasswordAttempts="5" minRequiredPasswordLength="1"
     minRequiredNonalphanumericCharacters="0" name="AspNetSqlMembershipProvider"
     type="System.Web.Security.SqlMembershipProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Question by:Dnx_7
    LVL 9

    Expert Comment

    what exactly does it do (or does it not do) ?
    LVL 10

    Accepted Solution


    You should use role based authentication. see the following link

    LVL 2

    Author Comment

    daniel balla :

    in fact the validation of user/pwd is correct, but i cannot redirect user to any page
    it's like there is something wrong in the web.config file

    systemExpert :
    that is what i'm trying to do but i get some errors
    LVL 2

    Author Comment

    ok i found the problem
    it was an error in the web.config file :)


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now