O'Reilly logo

Programming Visual Basic 2005 by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Anonymous Personalization

It is common to allow your users to personalize your site before identifying themselves. A classic example of this is Amazon.com , which lets you add books to your shopping cart before you log in (you only need to log in when you are ready to purchase what is in your cart).

ASP.NET 2.0 supports personalization for anonymous users as well as the ability later to link anonymous personalized data with a specific user's. Once that user logs in, you don't want to lose what was in the user's cart.

To enable anonymous personalization, you must update your Web.config file adding:

               
    <anonymousIdentification enabled="true" />

Add the attribute-value pair allowAnonymous="true" to the CHOSENBOOKS element of Web.config, as shown in Example 12-17.

Example 12-17. Modified Web.config for anonymous access

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
   <connectionStrings>
      <remove name="LocalSqlServer"/>
      <add name="LocalSqlServer" connectionString="data source=.\SqlExpress;Integrated
Security=SSPI;Initial Catalog=aspnetdb"/>
   </connectionStrings>
   <system.web>
      <anonymousIdentification enabled="true" /> <roleManager enabled="true" /> <authentication mode="Forms"/> <membership defaultProvider="AspNetSqlMembershipProvider"/> <compilation debug="true"/> <profile enabled="True" defaultProvider="AspNetSqlProfileProvider"> <properties> <add name="lastName" /> <add name="firstName" /> <add name="phoneNumber" /> <add name="birthDate" type="System.DateTime"/> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required