Personalization
 
Personalization Provider
 
As mentioned earlier, ASP.NET 2.0 equipped with two providers: SQL Server Express and SQL Server. The default provider is SQL Server Express. To change to the SQL Server provider (or your own), use the ASP.NET Web Application Administration tool. Under the Provider tab, click "Select a different provider for each feature (advanced)" and then select the relevant provider in the Profile Provider box.
 
In addition to the default providers, you might need to create and use a custom profile provider (e.g., you already have a database that stores user information, such as an employee database, or you need to use a database other than SQL Server or in some other format such as XML files). ASP.NET 2.0 also provides the ability to serve the properties stored in a user profile through different profile providers. This provides you the flexibility to manage data from different profile providers from multiple data sources for users of your application using a single user profile.
 
Working with SQL Server Express Edition
 
The MS-SQL Server data provider does allow to with the new SQL Server Express Edition fillies. It is the default provider used by personalization in ASP.NET. In Visual Studio 2005, the IDE places ASPNETDB.MDF file inside your application’s App_Data folder.
 
The SQL Server Express file’s connection string is specified through the LocalSqlServer declaration inside the section. You can use the personalization engine’s reference to this in the section within the machine.config file. The section contains a subsection listing all the providers available to the personalization engine.
 
Code sample for Adding a connection string to the SQL Server Express file is given below:
 
<configuration>
<ConnectionStrings>
<clear/>
<add name =? LocalSqlServer?
connectionString=?data source=.\SQLEXPRESS;Integrated Security=SSPI;
AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=True?
providerName=?System.Data.SqlClient? />
</ConnectionStrings>
</configuration>
Code sample for Adding a new SQL Server data provider is given below:
<configuration>
<system.web>
<profile>
<providers>
<add name="AspNetSqlProfileDataProvider"
connectionString=?LocalSqlServer?
applicationName=?/?
type=?System.Web.Profile.SqlProfileProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b0….? />
</providers>
</profile>

</system.web>
</configuration>
 
Using Multiple Providers
 
In ASP.NET 2.0, there is no limitation of using a data store or provider. You can use any number of providers. You can also specify the personalization provider for each property which is defined. This show that you can use default provider for most properties, as well as a few of them use a totally different provider. You can notice that a default provider is specified in the following code sample but AnyMember property uses an totally different personalization provider.
 
Sample Code:
<configuration>
<system.web>
<profile>
defaultProviders="AspNetSqlProfileDataProvider"
<properties>
<add name="FirstName" />
<add name="LastName" />
<add name="MobileNumber" />
<add name="AnyMember" provider=" AspNetSql2000Provider? />
</properties>
<profile>
</system.web>
</configuration>