ProfileManager Class
Manages user profile data and settings.
Assembly: System.Web (in System.Web.dll)
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 Profile property of the current HttpContext. Profile information and property values are managed using a profile provider.
The ProfileManager class is used to manage profile settings, search for user profiles, and delete user profiles that are no longer in use. The ProfileManager class provides static methods and properties that can be accessed by referencing the 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 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.
<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 SqlProfileProvider class that stores user profile properties in a SQL Server database. A 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 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.
<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>
The following code example shows an ASP.NET page that uses the ProfileManager class to manage inactive profiles.
Security Note: |
|---|
This example contains a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview. |
- AspNetHostingPermission
to use the ProfileManager class in a hosted environment. Demand value: LinkDemand. Permission value: Minimal.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Security Note: