MembershipProvider.PasswordAttemptWindow 属性

定义

获取在锁定成员资格用户之前允许的最大无效密码或无效密码提示问题答案尝试次数的分钟数。Gets the number of minutes in which a maximum number of invalid password or password-answer attempts are allowed before the membership user is locked out.

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

属性值

在锁定成员资格用户之前允许的最大无效密码或无效密码提示问题答案尝试次数的分钟数。The number of minutes in which a maximum number of invalid password or password-answer attempts are allowed before the membership user is locked out.

示例

有关MembershipProvider实现的示例,请参阅实现配置文件提供程序For an example of a MembershipProvider implementation, see Implementing a Profile Provider.

注解

PasswordAttemptWindow 属性MaxInvalidPasswordAttempts与属性结合使用,以防止不必要的源通过重复尝试来猜测成员资格用户的密码或密码答案。The PasswordAttemptWindow property works in conjunction with the MaxInvalidPasswordAttempts property to guard against an unwanted source guessing the password or password answer of a membership user through repeated attempts. 如果为成员资格用户提供的无效密码或密码问题的数目超过MaxInvalidPasswordAttempts了所标识PasswordAttemptWindow的分钟数,则会通过将IsLockedOut属性设置为来锁定成员资格用户。true直到用户通过调用UnlockUser方法解除锁定。If the number of invalid passwords or password questions supplied for a membership user exceeds the MaxInvalidPasswordAttempts within the number of minutes identified by the PasswordAttemptWindow, then the membership user is locked out by setting the IsLockedOut property to true until the user is unlocked by a call to the UnlockUser method. 如果在达到之前MaxInvalidPasswordAttempts提供了有效密码或密码答案,则跟踪无效尝试次数的计数器将重置为零。If a valid password or password answer is supplied before the MaxInvalidPasswordAttempts is reached, the counter that tracks the number of invalid attempts is reset to zero.

无效的密码和密码答案尝试彼此独立地累积。Invalid password and password-answer attempts accumulate independently of one another. 例如,如果MaxInvalidPasswordAttempts将属性设置为5,并在执行了两个无效密码答案尝试的情况下进行了三次无效的密码尝试,则必须在PasswordAttemptWindow要锁定的成员资格用户的值。For example, if the MaxInvalidPasswordAttempts property is set to 5, and three invalid password attempts are made followed by two invalid password-answer attempts, two more invalid password attempts (or three more invalid password-answer attempts) must be made within the PasswordAttemptWindow value for the membership user to be locked out.

false如果将RequiresQuestionAndAnswer属性设置为,则不会跟踪无效的密码答案尝试。If the RequiresQuestionAndAnswer property is set to false, invalid password-answer attempts are not tracked.

无效ValidateUser的密码和密码答案尝试在ChangePasswordQuestionAndAnswerChangePassword GetPassword、、和ResetPassword方法中进行跟踪。Invalid password and password-answer attempts are tracked in the ValidateUser, ChangePassword, ChangePasswordQuestionAndAnswer, GetPassword, and ResetPassword methods.

适用于

另请参阅