Skip to Content
Beginning ASP.NET 3.5: In C# and VB
book

Beginning ASP.NET 3.5: In C# and VB

by Imar Spaanjaars
March 2008
Intermediate to advanced content levelIntermediate to advanced
766 pages
21h 15m
English
Wrox
Content preview from Beginning ASP.NET 3.5: In C# and VB

15.3. The Role Manager

Although it's nice that your users can now sign up and log in to your site, it would be a lot more useful if you could differentiate between your users. That would enable you to grant access rights to one or just a few users to access the Management folder so only they can change your reviews and genres. With the Role Manager that ships with ASP.NET this is pretty easy to do. The Role Manager enables you to assign users to different roles. You can then use these roles to open or block specific functionality in your site. For example, you can block access to the Management folders to all users except for those in the Managers role. Additionally, you can display different content based on the roles users are in with the LoginView as you saw earlier.

15.3.1. Configuring the Role Manager

As with membership, the settings for the Role Manager are placed in config files. However, the Role Manager is not turned on by default, so you need to do that explicitly in the web.config file in the <roleManager> element that should be placed inside the <system.web> element in web.config:

<roleManager enabled="true" />

In a later exercise you see how to enable the roles with a management tool that is accessible from within VWD so you can enable roles without modifying the web.config file directly.

After you have enabled roles, you can assign users to different roles in a number of ways:

  • Using the Web Site Administration Tool, generally referred to as the WSAT

  • Programmatically ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning ASP.NET 4: in C# and VB

Beginning ASP.NET 4: in C# and VB

Imar Spaanjaars
Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Bill Evjen, Scott Hanselman, Devin Rader

Publisher Resources

ISBN: 9780470187593Purchase book