System.Web.Profile.SqlProfileProvider Class

Manages storage of profile information for an ASP.NET application in a SQL Server database.

See Also: SqlProfileProvider Members

Syntax

public class SqlProfileProvider : ProfileProvider

Remarks

The ASP.NET profile is used to store and retrieve user settings in a data source such as a database. The user profile is accessed using the System.Web.HttpContext.Profile property of the current System.Web.HttpContext. Profile information and property values are managed using a profile provider.

The System.Web.Profile.SqlProfileProvider class is used by ASP.NET to store and retrieve profile settings for an ASP.NET application that is using a SQL Server database. To use a System.Web.Profile.SqlProfileProvider, you must first create the SQL Server database used by the System.Web.Profile.SqlProfileProvider. To create the database used by the System.Web.Profile.SqlProfileProvider, run the aspnet_regsql.exe tool, which is found in the [drive:]\WINDOWS\Microsoft.NET\Framework\2.0versionNumber folder, and specify the -A p option. The following command demonstrates how you might use the aspnet_regsql.exe executable:

Example

aspnet_regsql.exe -A p

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.

The machine configuration contains a default System.Web.Profile.SqlProfileProvider instance named AspNetSqlProvider that connects to the SQL Server on the local machine. You can use this instance of the provider, or specify your own in the Web.config file for your ASP.NET application.

Note:

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.

Requirements

Namespace: System.Web.Profile
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0