How do you chcek what the username and role a user is a member of.

Posted on 2007-07-25
Last Modified: 2013-11-26
In vb 2005 When and How do you check what he username is and what role a user is a member of.
I have a login control on a form. When the login button is clicked I want to redirect to different pages depending on the role of the user.
Question by:whiwex
    LVL 12

    Expert Comment

    username is User.Identity.Name

    To check for a particular role, such as RoleA use ...
    LVL 12

    Accepted Solution

    Opps, username is User.Name

    you can also use the User.IsInRole("RoleA")

      to get all roles of an user .. Roles.GetRolesForUser ()

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Join & Write a Comment

    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    729 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

    19 Experts available now in Live!

    Get 1:1 Help Now