다음을 통해 공유


ASP.NET Profile Providers

The ASP.NET profile feature uses the same provider-based structure used by ASP.NET membership, ASP.NET role management, and other ASP.NET features. The ASP.NET profile feature works as a tiered system in which the functionality of the profile feature—providing typed property values and managing user identities—is separated from the underlying data storage. The profile feature relies on profile providers (data providers) to perform the back-end tasks required to store and retrieve profile property values.

Default Profile Provider

ASP.NET includes a profile provider that stores data using Microsoft SQL Server. The default ASP.NET machine configuration contains a default SqlProfileProvider instance named AspNetSqlProfileProvider that connects to SQL Server on the local machine. By default, the ASP.NET profile feature uses this instance of the provider. Alternatively, you can specify a different default provider in your application's Web.config file.

To use a SqlProfileProvider, you must first create the SQL Server database used by the SqlProfileProvider. You can create the database by running the Aspnet_regsql.exe command, which is found in the following path:

systemroot\Microsoft .NET\SDK\version

When you run the tool, you specify the -Ap option. The following command shows the syntax that you use to create the database required to store ASP.NET profiles using the SqlProfileProvider:

aspnet_regsql.exe -Ap

The example above does not specify a name for the database that is created, so the default name will be used. The default database name is Aspnetdb.

If the profile provider is configured with a connection string that uses integrated security, the process account of the ASP.NET application must have rights to connect to the SQL Server database.

Note

If you are using a SQL Server 2005 Express Edition database that is installed using the default configuration and the database is on the same computer as the Web server, the profile database will be created automatically by ASP.NET.

Custom Profile Providers

In some cases, you might want to create and use a custom profile provider. This is often true if you already have a database that stores user information, such as an employee database, if you need to use a database other than Microsoft SQL Server, or if you need to use a different data store, such as XML files. For more information, see Implementing a Profile Provider.

The properties stored in a user profile can all be served by different profile providers. You can therefore manage data from multiple data sources to store information for a single user profile.

See Also

Concepts

ASP.NET Profile Properties Overview

ASP.NET Profile Properties Overview

Defining ASP.NET Profile Properties

Implementing a Profile Provider