System.Web 2.0.0.0 System.Object

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 property of the current . Profile information and property values are managed using a profile provider.

The class is used to manage profile settings, search for user profiles, and delete user profiles that are no longer in use. The class provides static methods and properties that can be accessed by referencing the 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 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 class that stores user profile properties in a SQL Server database. A 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 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>`

Manages user profile data and settings.

- Property
  System.String To be added.

  The uses the property to associate profile information with different applications. This enables multiple applications to use the same database to store user information without running into conflicts between duplicate users. Multiple ASP.NET applications can use the same user database by specifying the same value in the property. The property can be set programmatically, or it can be set declaratively in the configuration file for the Web application by using the applicationName attribute.

  If a value is not specified for the applicationName attribute in the configuration file for the Web application, then the profile providers included with the .NET Framework use the property value for ASP.NET applications. For non-ASP.NET applications, the default value is the property value, without the file extension.

  The property exposes the property of the default profile provider. The default profile provider is specified using the defaultProvider attribute of the profile configuration element. If the user profile contains properties that are managed by a profile provider other than the default provider, they may be configured with a different application name. To access the application name of a profile provider other than the default provider, obtain a reference to the profile provider using the property and access the property of the provider directly.

  Because a single default profile provider instance is used for all of the requests served by an object, you can have multiple requests executing concurrently and attempting to set the property value. The property is not thread safe for multiple writes, and changing the property value can result in unexpected behavior for multiple users of an application. It is recommended that you avoid writing code that allows users to set the property unless you require it. An example of an application where setting the property may be required is an administrative application that manages profile data for multiple applications. Such an application should be a single-user application and not a Web application.

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

  2.0.0.0
- Property
  System.Boolean To be added.

  The property indicates whether automatic saving of the user profile is enabled for the application. If automatic saving is enabled, the object raises the event and calls the method during the event at the end of the execution of an ASP.NET page.

  The property is set using the automaticSaveEnabled attribute of the profile element in the Web.config file for an ASP.NET application.

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

  2.0.0.0
- Method
  System.Int32 `` ``

  The method is used to remove unused profile data from the data source for the application specified by the applicationName attribute in the configuration file. Use the parameter to specify whether you want only anonymous profiles, only authenticated profiles, or all profiles to be searched. Of the searched profiles, any profile with a that occurs on or before the specified parameter value is deleted.

  The method calls the method of the default profile provider. The default profile provider is specified using the defaultProvider attribute of the profile configuration element. If the user profile contains properties that are managed by a profile provider other than the default provider, the profile information in the other data source is not deleted. To delete inactive profiles that are managed by a profile provider other than the default provider, obtain a reference to the profile provider using the property and call the method of the provider directly.

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

  The number of profiles deleted from the data source.

  One of the enumeration values, specifying whether anonymous, authenticated, or both types of profiles are deleted. A that identifies which user profiles are considered inactive. If the of a user profile occurs on or before this date and time, the profile is considered inactive. 2.0.0.0
- Method
  System.Boolean ``

  The method deletes all profile information and properties for the user profile for the specified from the data source for the specified .

  The method calls the method of the default profile provider to perform the delete operation. The default profile provider is specified using the defaultProvider attribute of the profile configuration element. If the user profile contains properties that are managed by a profile provider other than the default provider, they are not deleted. To delete profile properties that are managed by a profile provider other than the default provider, obtain a reference to the profile provider using the property and call the method of the provider directly.

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

  true if the user profile was found and deleted; otherwise, false.

  The user name for the profile to be deleted. 2.0.0.0
- Method
  System.Int32 ``

  The method deletes all profile information and properties for the specified profiles from the data source for the application specified by the property. The list of profiles to delete is specified as a string array of user names. If profile properties and information exist in the data source for a user name in the parameter, they are deleted.

  The return value may differ from the length of the specified array of . This indicates that some of the profiles in the specified array of were already deleted from the data store.

  The method calls the method of the default profile provider. The default profile provider is specified using the defaultProvider attribute of the profile configuration element. If the user profile contains properties that are managed by a profile provider other than the default provider, they are not deleted. To delete profile properties that are managed by a profile provider other than the default provider, obtain a reference to the profile provider using the property and call the method of the provider directly.

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

  The number of profiles deleted from the data source.

  A string array of user names for profiles to be deleted. 2.0.0.0
- Method
  System.Int32 ``

  The method deletes all profile information and properties for the specified profiles from the data source for the application specified by the property. The list of profiles to delete is specified using a that is passed as the parameter. A can be returned from the , , , and methods.

  Note that the return value may differ from the value for the supplied . This indicates that some of the profiles in the specified were already deleted from the data store.

  The method calls the method of the default profile provider. The default profile provider is specified using the defaultProvider attribute of the profile configuration element. If the user profile contains properties that are managed by a profile provider other than the default provider, they are not deleted. To delete profile properties that are managed by a profile provider other than the default provider, obtain a reference to the profile provider using the property and call the method of the provider directly.

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

  The number of profiles deleted from the data source.

  A that contains profile information for profiles to be deleted. 2.0.0.0
- Property
  System.Boolean To be added.

  The user profile is enabled for an application using the enabled attribute of the profile configuration element.

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

  2.0.0.0
- Method
  System.Web.Profile.ProfileInfoCollection `` `` ``

  The method is used to retrieve profile information for all unused user profiles for the application specified by the applicationName attribute in the configuration file. This method will only retrieve profiles for which the profile user name matches the supplied parameter value. Use the parameter to specify whether you want only anonymous profiles, only authenticated profiles, or all profiles to be searched. Of the searched profiles, any profile with a that occurs on or before the specified parameter value is returned.

  You can retrieve this information in pages of data using the overload for the method that takes additional and parameters.

  Your profile provider may support wildcard characters in the parameter. For example, the method of the class supports wildcard characters in the parameter.

  The method calls the method of the default profile provider. The default profile provider is specified using the defaultProvider attribute of the profile configuration element. If the user profile contains properties that are managed by a profile provider other than the default provider, the data source for the other profile provider is not searched. To find inactive profiles that are managed by a profile provider other than the default provider, obtain a reference to the profile provider using the property and call the method of the provider directly.

  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.

  A containing user profile information for inactive profiles in which the user name matches the supplied parameter.

  One of the enumeration values, specifying whether anonymous, authenticated, or both types of profiles are returned. The user name for which to search. A that identifies which user profiles are considered inactive. If the of a user profile occurs on or before this date and time, the profile is considered inactive. 2.0.0.0
- Method
  System.Web.Profile.ProfileInfoCollection `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0
- Method
  System.Web.Profile.ProfileInfoCollection `` ``

  The method returns a list of all profile information for which the user name matches the supplied parameter value for the configured property value. Use the parameter to specify whether you want only anonymous profiles, only authenticated profiles, or all profiles to be searched.

  You can retrieve profile information for user profiles in pages of data using the overload for the method that takes additional and parameters.

  Note that your profile provider may support wildcard characters in the parameter. For example, the method of the class supports wildcard characters in the parameter.

  The method calls the method of the default profile provider. The default profile provider is specified using the defaultProvider attribute of the profile configuration element. If the user profile contains properties that are managed by a profile provider other than the default provider, the data source for the other profile provider is not searched. To find profiles that are managed by a profile provider other than the default provider, obtain a reference to the profile provider using the property and call the method of the provider directly.

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

  A containing user profile information for profiles where the user name matches the supplied parameter.

  One of the enumeration values, specifying whether anonymous, authenticated, or both types of profiles are returned. The user name for which to search. 2.0.0.0
- Method
  System.Web.Profile.ProfileInfoCollection `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0
- Method
  System.Web.Profile.ProfileInfoCollection `` ``

  The method is used to retrieve profile information from the data source for all unused user profiles for the application specified by the applicationName attribute in the configuration file. Use the parameter to specify whether you want only anonymous profiles, only authenticated profiles, or all profiles to be searched. Of the searched profiles, any profile is returned that has a that occurs on or before the specified parameter value.

  You can retrieve profile information for inactive user profiles in pages of data using the overload for the method that takes additional and parameters.

  The method calls the method of the default profile provider. The default profile provider is specified using the defaultProvider attribute of the profile configuration element. If the user profile contains properties that are managed by a profile provider other than the default provider, the data source for the other profile provider is not searched. To find unused profiles that are managed by a profile provider other than the default provider, obtain a reference to the profile provider using the property and call the method of the provider directly.

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

  A containing user profile information about the inactive profiles.

  One of the enumeration values, specifying whether anonymous, authenticated, or both types of profiles are returned. A that identifies which user profiles are considered inactive. If the of a user profile occurs on or before this date and time, the profile is considered inactive. 2.0.0.0
- Method
  System.Web.Profile.ProfileInfoCollection `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0
- Method
  System.Web.Profile.ProfileInfoCollection ``

  The method is used to retrieve profile information from the data source for the application specified by the applicationName attribute in the configuration file. Use the parameter to specify whether you want only anonymous profiles, only authenticated profiles, or all profiles to be searched.

  You can retrieve pages of objects for user profiles using the overload for the method that takes additional and parameters.

  The method calls the method of the default profile provider. The default profile provider is specified using the defaultProvider attribute of the profile configuration element. If the user profile contains properties that are managed by a profile provider other than the default provider, the data source for the other profile provider is not searched. To find profiles that are managed by a profile provider other than the default provider, obtain a reference to the profile provider using the property and call the method of the provider directly.

  Retrieves user profile data for profiles in the data source.

  A containing user profile information for all of the profiles in the data source.

  One of the enumeration values, specifying whether anonymous, authenticated, or both types of profiles are returned. 2.0.0.0
- Method
  System.Web.Profile.ProfileInfoCollection `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0
- Method
  System.Int32 `` ``

  The method is used to retrieve a count of all of the unused user profiles from the data source for the application specified by the applicationName attribute in the configuration file. Use the parameter to specify whether you want only anonymous profiles, only authenticated profiles, or all profiles to be searched. Of the searched profiles, all profiles are counted that have a that occurs on or before the specified parameter value.

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

  The number of profiles in the data source for which the last activity date occurred before the specified date and time.

  One of the enumeration values, specifying whether anonymous, authenticated, or both types of profiles are returned. A object that identifies which user profiles are considered inactive. If the of a user profile occurs on or before this date and time, the profile is considered inactive. 2.0.0.0
- Method
  System.Int32 ``

  The method is used to retrieve a count of all of the user profiles from the data source for the application specified by the applicationName attribute in the configuration file. Use the parameter to specify whether you want only anonymous profiles, only authenticated profiles, or all profiles to be searched.

  Gets the number of profiles in the data source.

  The number of profiles in the data source.

  One of the enumeration values, specifying whether anonymous, authenticated, or both types of profiles are returned. 2.0.0.0
- Property
  System.Web.Profile.ProfileProvider To be added.

  The property enables you to reference the default profile provider for an application directly. This is commonly used to access custom members of the profile provider that are not part of the abstract base class.

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

  2.0.0.0
- Property
  System.Web.Profile.ProfileProviderCollection To be added.

  The property references all of the profile providers enabled for an application, including providers added in the machine configuration and providers added in all Web.config files. You can control which profile providers are available for an application using the providers element of the profile section in the configuration file. For example, the following Web.config file removes the profile providers specified in parent configuration files and adds a instance as the profile provider for the application.

  `<configuration> <connectionStrings> <add name="SqlServices" connectionString= "Data Source=MySqlServer;Integrated Security=SSPI;Initial Catalog=aspnetdb;" /> </connectionStrings> <system.web> <profile enabled="true" defaultProvider="SqlProvider"> <providers> <clear /> <add name="SqlProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="SqlServices" applicationName="MyApplication" /> </providers> </profile> </system.web> </configuration>`

  When specifying the profile section, you must specify a default provider by setting the defaultProvider attribute. If you do not specify a profile section in your Web.config file, the values from the machine configuration are used and the instance named AspNetSqlProvider is established as the default provider.

  You can obtain a strongly typed reference to a provider from the collection by indexing the profile provider by name and casting it as the desired type.

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

  2.0.0.0