Reasons for creating a custom role provider:
- To store role information in a data source which doesn't supported by the role providers in the .NET Framework.
- To manage role information using a database schema different from the database schema used by the providers in the .NET Framework.
You need to create a class that inherits the RoleProvider abstract class from the System.Web.Security namespace. The RoleProvider abstract class then inherits the ProviderBase abstract class from the System.Configuration.Provider namespace. Next, you should retrieve the configuration information from the web.config file in the Initialize method.
At last, you have to implement GetRolesForUser method where you will get all the groups where the current user belongs to.
Thanx.
Join the conversation! Your thoughts help the community grow.