Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Feb 07, 2012 10:11 PM|LINK
I am creating my own "Roles".
I have a table of Roles in the DB and a table which holds which users belong to which roles.
I then want the ability in ASP.NET to see if a user belongs to a role using IsInRole(RoleName);
I understand I need to create a CustomPrincipal and implement the IPrincipal interface and for the IsInRole method, create the procedure I want to validate the parameter against a datasource.
Problem here is performance where it means I have to go to the DB everytime to see if the user (stored in session) belongs to that role.
Is there a way to cache the data for checking to see if the current user is in a role?
Maybe im missing something or a better way of doing this? I must stress that I want to use the User.IsInRole("...") method.