Initialize Method

SqlMembershipProvider.Initialize Method (String, NameValueCollection)

 

Initializes the SQL Server membership provider with the property values specified in the ASP.NET application's configuration file. This method is not intended to be used directly from your code.

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

public override void Initialize(
	string name,
	NameValueCollection config
)

Parameters

name
Type: System.String

The name of the SqlMembershipProvider instance to initialize.

config
Type: System.Collections.Specialized.NameValueCollection

A NameValueCollection that contains the names and values of configuration options for the membership provider.

Exception Condition
System.ArgumentNullException

config is null.

System.Configuration.Provider.ProviderException

The enablePasswordRetrieval, enablePasswordReset, requiresQuestionAndAnswer, or requiresUniqueEmail attribute is set to a value other than a Boolean.

- or -

The maxInvalidPasswordAttempts or the passwordAttemptWindow attribute is set to a value other than a positive integer.

- or -

The minRequiredPasswordLength attribute is set to a value other than a positive integer, or the value is greater than 128.

- or -

The minRequiredNonalphanumericCharacters attribute is set to a value other than zero or a positive integer, or the value is greater than 128.

- or -

The value for the passwordStrengthRegularExpression attribute is not a valid regular expression.

- or -

The applicationName attribute is set to a value that is greater than 256 characters.

- or -

The passwordFormat attribute specified in the application configuration file is an invalid MembershipPasswordFormat enumeration.

- or -

The passwordFormat attribute is set to Hashed and the enablePasswordRetrieval attribute is set to true in the application configuration.

- or -

The passwordFormat attribute is set to Encrypted and the configuration element specifies AutoGenerate for the decryptionKey attribute.

- or -

The connectionStringName attribute is empty or does not exist in the application configuration.

- or -

The value of the connection string for the connectionStringName attribute value is empty, or the specified connectionStringName does not exist in the application configuration file.

- or -

The value for the commandTimeout attribute is set to a value other than zero or a positive integer.

- or -

The application configuration file for this SqlMembershipProvider instance contains an unrecognized attribute.

HttpException

The current trust level is less than Low.

InvalidOperationException

The provider has already been initialized prior to the current call to the Initialize method.

This method initializes the SqlMembershipProvider with the property values specified in the ASP.NET application configuration file (Web.config) and is not intended to be used directly from your code.

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft