Ideally you should create a custom Role Provider. You can find plenty of articles how to do that, but you can also download the code for the existing providers from download.microsoft.com/download/a/b/3/ab3c284b-dc9a-473d-b7e3-33bacfcc8e98/ProviderToolkitSamples.msi
and just modify it.
ASP.NET improves performance by caching the roles in a cookie. This cookie is set when the user logs in and is passed to the application upo each request. The role manager can then check the cookie instead of the database (but check the db if no cookie exists).
Alternatively, within the provider, you could cache the roles per user in the ASP.NET Cache object.
Dave Sussman
All-Star
37716 Points
5005 Posts
ASPInsiders
MVP
Re: IsInRole Cache
Feb 08, 2012 09:28 AM|LINK
Ideally you should create a custom Role Provider. You can find plenty of articles how to do that, but you can also download the code for the existing providers from download.microsoft.com/download/a/b/3/ab3c284b-dc9a-473d-b7e3-33bacfcc8e98/ProviderToolkitSamples.msi and just modify it.
ASP.NET improves performance by caching the roles in a cookie. This cookie is set when the user logs in and is passed to the application upo each request. The role manager can then check the cookie instead of the database (but check the db if no cookie exists). Alternatively, within the provider, you could cache the roles per user in the ASP.NET Cache object.