共用方式為


SqlMembershipProvider.Initialize(String, NameValueCollection) 方法

定義

使用 ASP.NET 應用程式組態檔中指定的屬性值,初始化 SQL Server 成員資格提供者。 這個方法不能從程式碼直接使用。

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 執行個體之名稱。

config
NameValueCollection

NameValueCollection,包含成員資格提供者之組態選項的名稱和值。

例外狀況

confignull

enablePasswordRetrievalenablePasswordResetrequiresQuestionAndAnswerrequiresUniqueEmail 屬性設定為 Boolean 以外的值。

-或-

maxInvalidPasswordAttemptspasswordAttemptWindow 屬性設定為正整數以外的值。

-或-

minRequiredPasswordLength 屬性設定為正整數以外的值,或大於 128 的值。

-或-

minRequiredNonalphanumericCharacters 屬性設定為零或正整數以外的值,或大於 128 的值。

-或-

passwordStrengthRegularExpression 屬性的值不是有效的規則運算式。

-或-

applicationName 屬性設定為大於 256 個字元的值。

-或-

在應用程式組態檔中指定的 passwordFormat 屬性是無效的 MembershipPasswordFormat 列舉型別。

-或-

在應用程式組態中,passwordFormat 屬性設定為 Hashed,而 enablePasswordRetrieval 屬性設定為 true

-或-

passwordFormat 屬性設定為 Encrypted,而且 <machineKey> 組態元素為 decryptionKey 屬性指定 AutoGenerate

-或-

connectionStringName 屬性是空的,或不在應用程式組態中。

-或-

connectionStringName 屬性值的連接字串值是空的,或指定的 connectionStringName 值不在應用程式組態檔中。

-或-

commandTimeout 屬性值設定為零或正整數以外的值。

-或-

SqlMembershipProvider 執行個體的應用程式組態檔包含無法辨認的屬性。

目前信任的層級小於 Low

提供者已經在目前呼叫 Initialize(String, NameValueCollection) 方法之前進行初始化。

備註

這個方法會 SqlMembershipProvider 使用 ASP.NET 應用程式組態檔 (Web.config) 中指定的屬性值來初始化 ,而且不適合直接從您的程式碼使用。

適用於

另請參閱