Export (0) Print
Expand All

ProfileManager Class

Manages user profile data and settings.

System.Object
  System.Web.Profile.ProfileManager

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

[<AbstractClass>]
[<Sealed>]
type ProfileManager =  class end

The ProfileManager type exposes the following members.

  NameDescription
Public propertyStatic memberApplicationNameGets or sets the name of the application for which to store and retrieve profile information.
Public propertyStatic memberAutomaticSaveEnabledGets a value indicating whether the user profile will be automatically saved at the end of the execution of an ASP.NET page.
Public propertyStatic memberEnabledGets a value indicating whether the user profile is enabled for the application.
Public propertyStatic memberProviderGets a reference to the default profile provider for the application.
Public propertyStatic memberProvidersGets a collection of the profile providers for the ASP.NET application.
Top

  NameDescription
Public methodStatic memberAddDynamicProfilePropertyAdds a profile property programmatically.
Public methodStatic memberDeleteInactiveProfilesDeletes user profile data for which the last activity date and time occurred before the specified date and time.
Public methodStatic memberDeleteProfileDeletes the profile for the specified user name from the data source.
Public methodStatic memberDeleteProfiles(ProfileInfoCollection)Deletes profile properties and information from the data source for the supplied list of profiles.
Public methodStatic memberDeleteProfiles(String[])Deletes profile properties and information for the supplied list of user names.
Public methodStatic memberFindInactiveProfilesByUserName(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.
Public methodStatic memberFindInactiveProfilesByUserName(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.
Public methodStatic memberFindProfilesByUserName(ProfileAuthenticationOption, String)Retrieves all profile information for profiles in which the user name matches the specified name.
Public methodStatic memberFindProfilesByUserName(ProfileAuthenticationOption, String, Int32, Int32, Int32)Retrieves profile information in pages of data for profiles in which the user name matches the specified name.
Public methodStatic memberGetAllInactiveProfiles(ProfileAuthenticationOption, DateTime)Retrieves all user profile data for profiles in which the last activity date occurred on or before the specified date and time.
Public methodStatic memberGetAllInactiveProfiles(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.
Public methodStatic memberGetAllProfiles(ProfileAuthenticationOption)Retrieves user profile data for profiles in the data source.
Public methodStatic memberGetAllProfiles(ProfileAuthenticationOption, Int32, Int32, Int32)Retrieves pages of user profile data.
Public methodStatic memberGetNumberOfInactiveProfilesGets the number of profiles in which the last activity date occurred on or before the specified date.
Public methodStatic memberGetNumberOfProfilesGets the number of profiles in the data source.
Top

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 noteSecurity 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

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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

Community Additions

ADD
Show:
© 2014 Microsoft