How do I use RoleManager in my application?

From Guidance Share

Jump to: navigation, search

J.D. Meier, Prashant Bansode, Alex Mackman


To use role manager in an ASP.NET application, you need to enable role manager by setting <roleManager enabled="true"/> in the <system.web> section of your Web.config file and then configure your chosen role provider.

Supported role providers include AuthorizationStoreProvider, for using a Windows Server 2003 Authorization Manager policy store in ADAM, AD or an XML file, SqlRoleProvider for storing roles in SQL Server and the WindowsTokenRoleProvider for using Active Directory groups as roles.

You can programmatically check role membership by using the role manager API or you can configure URL authorization to automatically perform role-based authorization.

The benefit of using the role manager is that you have consistent role checks and you benefit from an abstraction over the underlying role store. Although you are unlikely to frequently change role providers, your development investments are protected if in the long term, you want to change to a different provider.

Personal tools