System.Web.Profile.ProfileManager.Providers Property

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

Syntax

public static ProfileProviderCollection Providers { get; }

Value

Documentation for this section has not yet been entered.

Remarks

The ProfileManager.Providers 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 System.Web.Profile.SqlProfileProvider instance as the profile provider for the application.

Example

<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 System.Web.Profile.SqlProfileProvider instance named AspNetSqlProvider is established as the default provider.

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

Requirements

Namespace: System.Web.Profile
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0