Creating Personalized Websites

The simplest form of personalization is to record information about the user and then to make that information available whenever the user logs on. This requires a kind of persistence that goes beyond session state. To create true personalization, you’ll want to store the user’s choices and information in a database that associates the saved information with a particular user, and persists indefinitely. Fortunately, ASP.NET provides all of the plumbing required. You do not need to design, edit, or manage the database tables; all of that is done for you.

You saw in Chapter 12 that by default, ASP.NET relies on a database to store the information for a site’s users and the roles to which they belong. That same database is also used in part to support the personalization of a website in conjunction with some alterations to the site’s web.config file. In this chapter, you’ll use a copy of the site created in Chapter 12 as a basis for working with ASP.NET’s profile provider.

Tip

You can find instructions on how to generate the ASP.NET membership database for your website in “Setting Up Forms-Based Authentication” in Chapter 12.

So, then, to get started, copy the C12_Security website folder and all its contents to a new folder called C14_Personalization, and then open that website in Visual Studio 2008 (VS2008). Set Welcome.aspx as the start page and run the program to make sure you have a working duplicate.

Tip

Profiles are related to specific users and not to ...

Get Programming ASP.NET 3.5, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.