ActiveDirectoryMembershipProvider.Initialize Method

Definition

Initializes the ActiveDirectoryMembershipProvider instance with the property values from the application's configuration files. This method is not intended to be called 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 ActiveDirectoryMembershipProvider instance to initialize.

config
NameValueCollection

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

Exceptions

config is null.

The applicationName attribute specified in the application configuration exceeds 256 characters.

-or-

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

-or-

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

-or-

The connectionProtection attribute is set to a value other than SignAndSeal or None in the application configuration file.

-or-

The connectionUsername attribute is specified in the application configuration file but its value is empty.

-or-

The connectionPassword attribute is specified in the application configuration file but its value is empty.

-or-

Either the connectionUsername attribute or the connectionPassword attribute is specified in the application configuration file, but not both.

-or-

The clientSearchTimeout attribute is specified but is not a positive integer.

-or-

The serverSearchTimeout attribute is specified but is not a positive integer.

-or-

The enableSearchMethods attribute is specified, but is not a Boolean value.

-or-

The requiresUniqueEmail attribute is specified, but is not a Boolean value.

-or-

The enablePasswordReset attribute is specified, but is not a Boolean value.

-or-

The requiresQuestionAndAnswer attribute is specified, but is not a Boolean value.

-or-

The minRequiredPasswordLength attribute is specified and it is either negative or greater than 128.

-or-

The minRequiredNonalphanumericCharacters attribute is specified and it is either negative or greater than 128.

-or-

The regular expression specified in the passwordStrengthRegularExpression attribute in the application configuration file is not a valid regular expression

-or-

The attributeMapUsername attribute is specified, but it is an empty string.

-or-

The connectionString attribute does not begin with "LDAP".

-or-

The connection string specified in the connectionString attribute is invalid.

-or-

The connection string in the connectionString attribute specifies a server-less bind.

-or-

The ActiveDirectoryMembershipProvider could not establish a connection with the domain or directory server.

-or-

The connectionProtection attribute is set to SignAndSeal, but neither an SSL nor a signed and sealed connection can be established with the server.

-or-

The connectionProtection attribute is set to None but the connectionUsername and connectionPassword attributes are not set.

-or-

The connectionProtection attribute is set to SignAndSeal but the ActiveDirectoryMembershipProvider could not establish an SSL connection with an ADAM server.

-or-

The connectionString attribute specifies either the global catalog (GC) or an SSL global catalog port.

-or-

The connectionString attribute specifies an Active Directory server or domain, but the ActiveDirectoryMembershipProvider could not retrieve the default naming context for the domain.

-or-

The connectionString attribute specifies an Active Directory server or domain, but the ActiveDirectoryMembershipProvider could not retrieve the default users container.

-or-

The connectionString attribute specifies an ADAM server, but it does not specify an application partition or container.

-or-

The connectionString attribute specifies an application partition or container, but the specified container does not exist.

-or-

The connectionString attribute specifies a container that is not allowed to contain user instances.

An attribute mapping is specified but its value was empty.

-or-

An attribute mapping is specified twice.

-or-

An attribute mapping is specified but the attribute does not exist on the user instance.

-or-

An attribute mapping is specified but the directory attribute is not of the correct data type.

-or-

An attribute mapping is specified but the directory attribute is multi-valued.

-or-

The attributeMapUserName attribute is specified but was mapped to neither the sAMAccountName nor the userPrincipalName directory attribute when connecting to an Active Directory.

-or-

The attributeMapUserName attribute is specified but was not mapped to the userPrincipalName directory attribute when connecting to an ADAM server.

-or-

The enablePasswordReset attribute is true and the requiresQuestionAndAnswer attribute is false in the application configuration file.

-or-

The maxInvalidPasswordAttempts attribute was specified but is not a non-zero positive integer.

-or-

The passwordAttemptWindow attribute was specified but is not a non-zero positive integer.

-or-

The passwordAnswerAttemptLockoutDuration attribute was specified but is not a non-zero positive integer.

-or-

The enablePasswordReset attribute is true and any of the attributeMapFailedPasswordAnswerCount, attributeMapFailedPasswordAnswerTime, and attributeMapFailedPasswordAnswerLockoutTime attributes are empty.

-or-

The requiresQuestionAndAnswer attribute is true but either the attributeMapPasswordQuestion or the attributeMapPasswordAnswer attribute is empty.

-or-

An attribute specified in the application configuration file is not valid.

The application is running in a hosted environment and the AspNetHostingPermissionLevel is set to Minimal.

An error occurred while querying the directory.

Remarks

This method initializes the ActiveDirectoryMembershipProvider object 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