MembershipProvider.MaxInvalidPasswordAttempts 属性

定义

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

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

属性值

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

示例

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

注解

MaxInvalidPasswordAttempts 属性PasswordAttemptWindow与属性结合使用,以防止不必要的源通过重复尝试来猜测成员资格用户的密码或密码答案。The MaxInvalidPasswordAttempts property works in conjunction with the PasswordAttemptWindow property to guard against an unwanted source guessing the password or password answer of a membership user through repeated attempts. 如果为成员资格用户提供的无效密码或密码问题的数量大于或等于MaxInvalidPasswordAttempts由标识PasswordAttemptWindow的分钟数内的属性值,则会通过将属性, true 直到UnlockUser通过调用方法取消锁定用户为止。 IsLockedOutIf the number of invalid passwords or password questions supplied for a membership user is greater than or equal to the MaxInvalidPasswordAttempts property value 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 value 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 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.

适用于

另请参阅