次の方法で共有


ActiveDirectoryMembershipProvider.RequiresQuestionAndAnswer プロパティ

定義

ユーザーの作成時にパスワードの質問と解答を要求するようにメンバーシップ プロバイダーが構成されているかどうかを示す値を取得します。

public:
 virtual property bool RequiresQuestionAndAnswer { bool get(); };
public override bool RequiresQuestionAndAnswer { get; }
member this.RequiresQuestionAndAnswer : bool
Public Overrides ReadOnly Property RequiresQuestionAndAnswer As Boolean

プロパティ値

ActiveDirectoryMembershipProvider オブジェクトがユーザーのパスワードの質問と解答を要求するように構成されている場合は true。それ以外の場合は false。 既定値は、false です。

例外

RequiresQuestionAndAnswer インスタンスが初期化される前に、ActiveDirectoryMembershipProvider プロパティにアクセスしようとしました。

次のコード例は、パスワードリセットを有効にするようにインスタンスを ActiveDirectoryMembershipProvider 構成する Web.config エントリを示しています。 "パスワードのリセット" アクセス権を持つユーザーの明示的な資格情報が使用されます。

重要

Web.config ファイルにユーザー資格情報を配置すると、セキュリティ上の脅威が発生する可能性があります。 Web.config ファイルを含むディレクトリへのアクセス権を持つユーザーは、ファイルを読み取ることができるため、資格情報が表示されます。 この脅威から保護する方法の詳細については、「保護 された構成を使用した構成情報の暗号化」を参照してください。

<configuration>  
  <connectionStrings>  
    <add name="ADService" connectionString="LDAP://ldapServer/" />  
  </connectionStrings>  
  <system.web>  
    <membership defaultProvider="AspNetActiveDirectoryMembershipProvider">  
      <providers>  
        <add name="AspNetActiveDirectoryMembershipProvider"   
          type="System.Web.Security.ActiveDirectoryMembershipProvider,   
          System.Web, Version=2.0.3600, Culture=neutral,  
          PublicKeyToken=b03f5f7f11d50a3a"  
          connectionUsername="UserWithResetPasswordRights"  
          connectionPassword="PasswordForUser"  
          enablePasswordReset="true"  
          requiresQuestionAndAnswer="true"  
          attributeMapPasswordQuestion="PasswordQuestionADAttribute"  
          attributeMapPasswordAnswer="PasswordAnswerADAttribute"  
          attributeMapFailedPasswordAnswerCount="AnswerCountADAttribute"  
          attributeMapFailedPasswordAnswerTime="AnswerTimeADAttribute"  
          attributeMapFailedPasswordAnswerLockoutTime="LockOutTimeADAttribute" />  
      </providers>  
    </membership>  
  </system.web>  
</configuration>  

注釈

プロパティはRequiresQuestionAndAnswermembership Element (ASP.NET Settings Schema) 要素の属性を使用してrequiresQuestionAndAnswer、アプリケーションの構成ファイルで設定されます。 プロパティがアプリケーションの構成ファイルで設定されていない場合、 RequiresQuestionAndAnswer プロパティは の false既定値に設定されます。

属性が requiresQuestionAndAnswertrue設定されている場合は、これらの追加の属性も設定する必要があります。

  • attributeMapPasswordQuestionattributeMapPasswordAnswer は、Active Directory スキーマの属性にマップする必要があります。

上記の条件が満たされない場合は、初期化時に が ProviderException スローされます。

注意

ユーザーの作成時にパスワードの質問と回答を要求できますが、 クラスをEnablePasswordReset使用してユーザーがパスワードを変更できないようにするには、 プロパティを ActiveDirectoryMembershipProviderfalse設定します。

適用対象

こちらもご覧ください