ProfileManager Class

 

Manages user profile data and settings.

Namespace:   System.Web.Profile
Assembly:  System.Web (in System.Web.dll)

System::Object
  System.Web.Profile::ProfileManager

public ref class ProfileManager abstract sealed 

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticApplicationName

Gets or sets the name of the application for which to store and retrieve profile information.

System_CAPS_pubpropertySystem_CAPS_staticAutomaticSaveEnabled

Gets a value indicating whether the user profile will be automatically saved at the end of the execution of an ASP.NET page.

System_CAPS_pubpropertySystem_CAPS_staticEnabled

Gets a value indicating whether the user profile is enabled for the application.

System_CAPS_pubpropertySystem_CAPS_staticProvider

Gets a reference to the default profile provider for the application.

System_CAPS_pubpropertySystem_CAPS_staticProviders

Gets a collection of the profile providers for the ASP.NET application.

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticAddDynamicProfileProperty(ProfilePropertySettings^)

Adds a profile property programmatically.

System_CAPS_pubmethodSystem_CAPS_staticDeleteInactiveProfiles(ProfileAuthenticationOption, DateTime)

Deletes user profile data for which the last activity date and time occurred before the specified date and time.

System_CAPS_pubmethodSystem_CAPS_staticDeleteProfile(String^)

Deletes the profile for the specified user name from the data source.

System_CAPS_pubmethodSystem_CAPS_staticDeleteProfiles(ProfileInfoCollection^)

Deletes profile properties and information from the data source for the supplied list of profiles.

System_CAPS_pubmethodSystem_CAPS_staticDeleteProfiles(array<String^>^)

Deletes profile properties and information for the supplied list of user names.

System_CAPS_pubmethodSystem_CAPS_staticFindInactiveProfilesByUserName(ProfileAuthenticationOption, String^, DateTime)

Retrieves profile information for all profiles in which the last activity date occurred on or before the specified date and time and the user name for the profile matches the specified name.

System_CAPS_pubmethodSystem_CAPS_staticFindInactiveProfilesByUserName(ProfileAuthenticationOption, String^, DateTime, Int32, Int32, Int32%)

Retrieves profile information in pages of data for profiles in which the last activity date occurred on or before the specified date and time and the user name for the profile matches the specified name.

System_CAPS_pubmethodSystem_CAPS_staticFindProfilesByUserName(ProfileAuthenticationOption, String^)

Retrieves all profile information for profiles in which the user name matches the specified name.

System_CAPS_pubmethodSystem_CAPS_staticFindProfilesByUserName(ProfileAuthenticationOption, String^, Int32, Int32, Int32%)

Retrieves profile information in pages of data for profiles in which the user name matches the specified name.

System_CAPS_pubmethodSystem_CAPS_staticGetAllInactiveProfiles(ProfileAuthenticationOption, DateTime)

Retrieves all user profile data for profiles in which the last activity date occurred on or before the specified date and time.

System_CAPS_pubmethodSystem_CAPS_staticGetAllInactiveProfiles(ProfileAuthenticationOption, DateTime, Int32, Int32, Int32%)

Retrieves a page of ProfileInfo objects for user profiles in which the last activity date occurred on or before the specified date and time.

System_CAPS_pubmethodSystem_CAPS_staticGetAllProfiles(ProfileAuthenticationOption)

Retrieves user profile data for profiles in the data source.

System_CAPS_pubmethodSystem_CAPS_staticGetAllProfiles(ProfileAuthenticationOption, Int32, Int32, Int32%)

Retrieves pages of user profile data.

System_CAPS_pubmethodSystem_CAPS_staticGetNumberOfInactiveProfiles(ProfileAuthenticationOption, DateTime)

Gets the number of profiles in which the last activity date occurred on or before the specified date.

System_CAPS_pubmethodSystem_CAPS_staticGetNumberOfProfiles(ProfileAuthenticationOption)

Gets the number of profiles in the data source.

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 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 configuration element and the defaultProvider attribute of the 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.

System_CAPS_security 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.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: