This documentation is archived and is not being maintained.

ProvidersHelper::InstantiateProvider Method

Initializes and returns a single provider of the given type using the supplied settings.

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

[AspNetHostingPermissionAttribute(SecurityAction::Demand, Level = AspNetHostingPermissionLevel::Low)]
public:
static ProviderBase^ InstantiateProvider(
	ProviderSettings^ providerSettings, 
	Type^ providerType
)

Parameters

providerSettings
Type: System.Configuration::ProviderSettings
The settings to be passed to the provider upon initialization.
providerType
Type: System::Type
The Type of the provider to be initialized.

Return Value

Type: System.Configuration.Provider::ProviderBase
A new provider of the given type using the supplied settings.

ExceptionCondition
ArgumentException

The provider type defined in configuration was nullptr or an empty string ("").

- or -

The provider type defined in configuration is not compatible with the type used by the feature that is attempting to create a new instance of the provider.

ConfigurationErrorsException

The provider threw an exception while it was being initialized.

- or -

An error occurred while attempting to resolve a Type instance for the provider specified in providerSettings.

.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.
Show: