Beginning ASP.NET 2.0 With CSharp (2006) [eng]
.pdf
11
Roles and Profiles
In Chapter 4, you learned how ASP.NET handles simple user accounts, how access to a site can be controlled on a user-by-user basis, and how to group users into roles and control access to a site through the use of roles. Using the ASP.NET Web Site Administration Tool, you have the ability to define user accounts, administer roles, and set security permissions all in one central location. This chapter revisits the concept of roles and looks at how accounts and roles are used in Wrox United. You also learn how to control program logic and flow based on which roles the current user is a member of, all using code.
Additionally, because you should now feel comfortable working with .NET code, this chapter takes you on a tour of user profiles. The user profiles that you can create in ASP.NET can store additional information on a user-account-by-user-account basis; for example, a user’s favorite football team or favorite color. You’ll recall that, in Chapter 5, the concepts of styling controls and pages using central themes were discussed; in this chapter, one of the items you’ll be adding to user profiles is the preferred theme to use for a specific web site.
In this chapter, you learn how to:
Manage site accessibility on a role-by-role basis in code
Use roles effectively in a site, using the Wrox United site as an example
Employ user profiles to store additional information about a user
Work with profiles in code to store and apply favorite themes to a site
This chapter revisits Wrox United and introduces the Fan Club page to the site. In this page, you’ll learn how to display different content depending on which role a user is a member of, and how to update a user’s profile. You’ll also make use of the powerful LoginView control, which simplifies the process of displaying different content dependent on role membership.
