Bewerken

Delen via


SqlMembershipProvider.Initialize(String, NameValueCollection) Method

Definition

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.

public:
 override void Initialize(System::String ^ name, System::Collections::Specialized::NameValueCollection ^ config);
public override void Initialize (string name, System.Collections.Specialized.NameValueCollection config);
override this.Initialize : string * System.Collections.Specialized.NameValueCollection -> unit
Public Overrides Sub Initialize (name As String, config As NameValueCollection)

Parameters

name
String

The name of the SqlMembershipProvider instance to initialize.

config
NameValueCollection

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

Exceptions

config is null.

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 <machineKey> 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.

The current trust level is less than Low.

The provider has already been initialized prior to the current call to the Initialize(String, NameValueCollection) method.

Remarks

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.

Applies to

See also