ActiveDirectoryMembershipProvider.PasswordAnswerAttemptLockoutDuration 属性

定义

获取用户多次未能正确回答密码提示问题后用户帐户的锁定时间长度。

public:
 property int PasswordAnswerAttemptLockoutDuration { int get(); };
public int PasswordAnswerAttemptLockoutDuration { get; }
member this.PasswordAnswerAttemptLockoutDuration : int
Public ReadOnly Property PasswordAnswerAttemptLockoutDuration As Integer

属性值

用户多次提供错误的密码提示问题答案后的锁定时间(以分钟为单位)。

例外

示例

下面的代码示例演示了一个 Web.config 条目,该条目将实例配置为 ActiveDirectoryMembershipProvider 锁定在 10 分钟时间范围内尝试输入密码答案的三次失败的用户。 如果用户被锁定,则 15 分钟内可能不会再尝试回答密码问题。

<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"  
          maxInvalidPasswordAttempts="3"  
          passwordAttemptWindow="10"  
          passwordAnswerAttemptLockoutDuration="15" />  
      </providers>  
    </membership>  
  </system.web>  
</configuration>  

注解

EnablePasswordReset当 属性为 true时,用户必须回答密码问题才能重置其密码。 如果用户未能在属性指定的PasswordAttemptWindow观察时间段内连续多次提供与MaxInvalidPasswordAttempts属性值相等的正确答案,则会在属性中包含的PasswordAnswerAttemptLockoutDuration分钟数内锁定用户进一步尝试。

注意

此属性不设置用户在输入有效密码失败后被锁定的持续时间。 Active Directory 服务器处理失败的登录尝试,并且不受此属性的值的影响。 建议将 PasswordAnswerAttemptLockoutDuration 属性设置为与在 Active Directory 配置中为过多失败登录尝试指定的帐户锁定持续时间相同的值。 这将为用户呈现一致的自动锁定行为,无论用户是因登录尝试失败还是密码答案错误而被锁定。

属性 PasswordAnswerAttemptLockoutDurationpasswordAnswerAttemptLockoutDuration 应用程序的配置文件中使用 成员资格元素 (ASP.NET 设置架构) 元素的属性进行设置。 如果未在应用程序的配置文件中设置 属性,则 PasswordAnswerAttemptLockoutDuration 属性设置为默认值 30 分钟。

适用于

另请参阅