This documentation is archived and is not being maintained.

ActiveDirectoryMembershipProvider.Initialize Method

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.

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

[DirectoryServicesPermissionAttribute(SecurityAction.Assert, Unrestricted = true)]
[DirectoryServicesPermissionAttribute(SecurityAction.Demand, Unrestricted = true)]
[DirectoryServicesPermissionAttribute(SecurityAction.InheritanceDemand, Unrestricted = true)]
public override void Initialize(
	string name,
	NameValueCollection config
)

Parameters

name
Type: System.String
The name of the ActiveDirectoryMembershipProvider instance to initialize.
config
Type: System.Collections.Specialized.NameValueCollection
A NameValueCollection containing the names and values of the configuration options for the membership provider.

ExceptionCondition
ArgumentNullException

config is null.

ProviderException

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.

HttpException

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

COMException

An error occurred while querying the directory.

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.

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