SqlMembershipProvider.Initialize(String, NameValueCollection) 方法

定义

使用 ASP.NET 应用程序配置文件中指定的属性值初始化 SQL Server 成员资格提供程序。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)

参数

name
String

要初始化的 SqlMembershipProvider 实例的名称。The name of the SqlMembershipProvider instance to initialize.

config
NameValueCollection

一个 NameValueCollection,其中包含成员资格提供程序配置选项的值和名称。A NameValueCollection that contains the names and values of configuration options for the membership provider.

异常

confignullconfig is null.

enablePasswordRetrievalenablePasswordResetrequiresQuestionAndAnswerrequiresUniqueEmail 特性设置为一个非 Boolean 值。The enablePasswordRetrieval, enablePasswordReset, requiresQuestionAndAnswer, or requiresUniqueEmail attribute is set to a value other than a Boolean.

- 或 --or- maxInvalidPasswordAttemptspasswordAttemptWindow 特性设置为一个非正整数值。The maxInvalidPasswordAttempts or the passwordAttemptWindow attribute is set to a value other than a positive integer.

-or- minRequiredPasswordLength 特性设置为一个非正整数值或大于 128 的值。The minRequiredPasswordLength attribute is set to a value other than a positive integer, or the value is greater than 128.

- 或 --or- minRequiredNonalphanumericCharacters 特性设置为一个非正整数或零的值,或者设置为一个大于 128 的值。The minRequiredNonalphanumericCharacters attribute is set to a value other than zero or a positive integer, or the value is greater than 128.

-or- passwordStrengthRegularExpression 特性的值不是有效正则表达式。The value for the passwordStrengthRegularExpression attribute is not a valid regular expression.

- 或 --or- applicationName 特性设置为一个大于 256 个字符的值。The applicationName attribute is set to a value that is greater than 256 characters.

-or- 应用程序配置文件中指定的 passwordFormat 特性是一个无效 MembershipPasswordFormat 枚举。The passwordFormat attribute specified in the application configuration file is an invalid MembershipPasswordFormat enumeration.

-or- 在应用程序配置中,passwordFormat 特性设置为 HashedenablePasswordRetrieval 特性设置为 trueThe passwordFormat attribute is set to Hashed and the enablePasswordRetrieval attribute is set to true in the application configuration.

- 或 --or- passwordFormat 特性设置为 Encrypted<machineKey> 配置元素为 decryptionKey 特性指定了 AutoGenerateThe passwordFormat attribute is set to Encrypted and the <machineKey> configuration element specifies AutoGenerate for the decryptionKey attribute.

-or- connectionStringName 特性为空或应用程序配置中不存在该特性。The connectionStringName attribute is empty or does not exist in the application configuration.

-or- connectionStringName 特性值的连接字符串的值为空,或应用程序配置文件中不存在指定的 connectionStringNameThe 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- commandTimeout 特性的值设置为一个非正整数或零的值。The value for the commandTimeout attribute is set to a value other than zero or a positive integer.

-or- SqlMembershipProvider 实例的应用程序配置文件包含无法识别的特性。The application configuration file for this SqlMembershipProvider instance contains an unrecognized attribute.

当前信任级别低于 LowThe current trust level is less than Low.

在当前对 Initialize(String, NameValueCollection) 方法的调用之前已初始化了提供程序。The provider has already been initialized prior to the current call to the Initialize(String, NameValueCollection) method.

注解

此方法SqlMembershipProvider使用在 ASP.NET 应用程序配置文件(web.config)中指定的属性值初始化,不应在代码中直接使用。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.

适用于

另请参阅