Personalization
 
Anonymous Personalization
 
In ASP.NET 2.0, anonymous personalization is disabled by default. Sometimes you will need to store data in the profile object for anonymous users as well. To accomplish this, you must first enable another ASP.NET 2.0 feature: anonymous identification. You also must mark properties in the section with a special Boolean attribute: allowAnonymous. The following code demonstrates how to set up the web.config file to allow for anonymous users:
 
Sample Code:
<configuration>
<system.web>
<anonymousIdentification enabled="True"/>
<profile>
<properties>
<add name="FirstName" allowAnonymous="true" type="System.String"/>
<add name="LastName" allowAnonymous="true" type="System.String"/>
----
</properties>
</profile>
</system.web>
</configuration>
 
When anonymous identification is turned on, ASP.NET uses a unique identifier for each anonymous user who comes to the application. This identifier is sent with each and every request, although after the end user becomes authenticated by ASP.NET, the identifier is removed from the process.
 
For an anonymous user, information is stored by default as cookie on the end user’s machine. Additional information is stored in the specified data store on the server.
 
Sample Code:
<configuration>
<system.web>
<anonymousIdentification enabled="True"
//To change the default cookie name (.ASPXAONYMOUS) to your defined name.
cookieName=?.MyPersonlizationApp?
//To change the default period (100,000 minutes) of cookie to persist on user’s machine.
cookieTimepout=?1500?
</system.web>
</configuration>