16.3. Practical Personalization Tips

The following list provides some personalization tips.

  • Don't try to access the Profile in the Login page, as it isn't available yet. The Profile is instantiated early in the page's life cycle, so when a Login control authenticates you in a Login page, it's too late to associate the user's Profile with the current request. Use the GetProfile method of ProfileCommon instead or redirect to another page.

  • Carefully consider what to store in Profile and what is better stored in your own database tables. Although the single-record structure that ASP.NET uses to store your profile offers you a quick and convenient solution, it's not the most efficient solution, especially not with large amounts of data. Don't try to store complete reviews or even photo albums in Profile, but use your own database tables instead.

  • The current implementation of Profile makes it difficult to query data from the aspnet_Profile database in your own queries. For example, it's difficult to answer queries like: "Give me all users that prefer the Rock genre" because all the data is stored in a single column. To work around these issues, you can use a different Profile provider that you can download from the Sandbox section of the official ASP.NET web site: www.asp.net/downloads/sandbox/.

Get Beginning ASP.NET 3.5: In C# and VB 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.