Role based Authorization (User.IsInRole("Administrator"))

Posted on 2008-11-07
Last Modified: 2012-05-05
I have recently inherited an existing system and I need to access the User.IsInRole function from with the Authenticate method -- is this possible.

Once the Authenticate method is executed User object is always available but is *not* populated when one tries to access it in the Authenticate method itself.

The application uses the in built login controls. the environment is .net 2.0.


Question by:sanagarwl
    1 Comment
    LVL 8

    Accepted Solution

    Instead of User.IsInRole, use Roles.IsUserInRole("username","Your Role")

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    728 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

    18 Experts available now in Live!

    Get 1:1 Help Now