使用SqlMembershipProvider禁用帐户锁定 [英] Disabling account lockout with the SqlMembershipProvider

查看:108
本文介绍了使用SqlMembershipProvider禁用帐户锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何禁用 SqlMembershipProvider 的帐户锁定功能?

How do I disable the account lockout feature of the SqlMembershipProvider?

MaxInvalidPasswordAttempts的MSDN文档 a>属性未指定如何禁用它.如果找不到正确的方法,我将把maxInvalidPasswordAttempts属性设置为一个int的最大值,这可以有效地达到相同的结果.

The MSDN documentation for the MaxInvalidPasswordAttempts property does not specify how to disable it. If I can't find the correct way to do it I will set the maxInvalidPasswordAttempts attribute to the maximum value of an int which may effectively achieve the same result.

我很清楚,禁用帐户锁定并不是最好的主意,但我需要在短期内实现.

I'm well aware that disabling account lockout isn't the greatest idea but I need to achieve this in the short term.

推荐答案

将maxInvalidPasswordAttempts属性设置为Int32.MaxValue可以按照我在问题中的建议以及下面的web.config片段中的说明进行操作.我已经使用 Reflector 来查看SqlMembershipProvider的实现,但是看不到如何禁用帐户锁定功能是明确的,因此我将接受它作为解决方案.

Setting the maxInvalidPasswordAttempts attribute to Int32.MaxValue works as I suggested in my question and as illustrated in the web.config fragment below. I've used Reflector to look at the SqlMembershipProvider implementation and cannot see how to disable the account lockout feature explicitly so I'm going to accept this as a solution.

我没有测试过建议彻底设置PasswordAttemptWindow的建议,但是不能将其设置为0(必须为正整数,即至少一分钟),因此,在不将maxInvalidPasswordAttempts属性设置得足够高以防止出现以下情况的情况下也无法使用:一分钟内锁定.

I did not test the suggestion to set PasswordAttemptWindow thoroughly but it cannot be set to 0 (must be a positive integer, i.e a minimum of one minute) so this would not work without also setting the maxInvalidPasswordAttempts attribute high enough to prevent a lockout within a one minute period.

<membership defaultProvider="SqlMembershipProvider">
  <providers>
    <add name="SqlMembershipProvider" type="..."
         maxInvalidPasswordAttempts="2147483647"
         />
  </providers>

这篇关于使用SqlMembershipProvider禁用帐户锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆