See Also: ProfileManager Members
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.ProfileManager class is used to manage profile settings, search for user profiles, and delete user profiles that are no longer in use. The System.Web.Profile.ProfileManager class provides static methods and properties that can be accessed by referencing the System.Web.Profile.ProfileManager class in your application code. For an example, see the Example section in this topic and additional examples in the topics for members of the System.Web.Profile.ProfileManager class.
By default, the user profile is disabled for all ASP.NET applications. To enable the user profile, set the enabled attribute of the profile configuration element to true, as shown in the following example.
Example
<configuration> <system.web> <profile enabled="true" /> </system.web> </configuration>
For more information about the user profile, see ASP.NET Profile Properties Overview.
A profile provider is used to store and retrieve properties in the user profile. The .NET Framework includes a System.Web.Profile.SqlProfileProvider class that stores user profile properties in a SQL Server database. A System.Web.Profile.SqlProfileProvider instance named AspNetSqlProvider is specified in the machine configuration as the default profile provider. The AspNetSqlProvider instance connects to the SQL Server database on the local Web server. You can specify a System.Web.Profile.SqlProfileProvider that connects to another SQL Server as the default profile provider by using the providers configuration element and the defaultProvider attribute of the profile configuration element, as shown in the following example.
Example
<configuration> <connectionStrings> <add name="SqlServices" connectionString= "Data Source=MySqlServer;Integrated Security=SSPI;Initial Catalog=aspnetdb;" /> </connectionStrings> <system.web> <profile defaultProvider="SqlProvider"> <providers> <clear /> <add name="SqlProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="SqlServices" applicationName="MyApplication" /> </providers> </profile> </system.web> </configuration>