ASP.NET 2.0 会员资格:ValidateUser 未锁定用户?
我在 ASP.NET 2.0 网站中使用默认的 SQLMembershipProvider,并期望 Membership.ValidateUser 在输入多次错误密码(在我的例子中为 5 个)后锁定用户,但 ValidateUser 似乎并不关心记录错误密码尝试次数并锁定用户。
怎么了?
我的 web.config 中的成员资格配置:
<membership defaultProvider="SqlMembershipProvider" >
<providers>
<clear />
<add connectionStringName="ConnectionStringName" enablePasswordRetrieval="true"
enablePasswordReset="true" requiresQuestionAndAnswer="false"
requiresUniqueEmail="true" passwordFormat="Encrypted" maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10" passwordStrengthRegularExpression=""
applicationName="MyApp" name="SqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
I am using the default SQLMembershipProvider in my ASP.NET 2.0 website, and expect the Membership.ValidateUser to lock-out the user after entering a number of wrong passwords (5, in my case) but ValidateUser doesn't seem to be caring about keeping count of bad password attempts and locking out the user.
What's wrong?
The Membership configuration in my web.config:
<membership defaultProvider="SqlMembershipProvider" >
<providers>
<clear />
<add connectionStringName="ConnectionStringName" enablePasswordRetrieval="true"
enablePasswordReset="true" requiresQuestionAndAnswer="false"
requiresUniqueEmail="true" passwordFormat="Encrypted" maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10" passwordStrengthRegularExpression=""
applicationName="MyApp" name="SqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
PasswordAttemptWindow 和 MaxInvalidPasswordAttempts 设置为多少? 这些配置设置是否在正确的 web.config 中设置? (测试环境实际使用的)
what is the PasswordAttemptWindow and MaxInvalidPasswordAttempts set to? and is these configuration settings set in the correct web.config? (the one actual in use by the test environment)
这是我的会员资格使用情况的配置,如果有任何用途,它可以按要求工作:
另外,您是否尝试过使用 .Login() 方法进行身份验证过程? 这就是我正在使用的而不是 validateuser()。
Here's the config for my membership usage which is working as required if it's of any use:
Also, have you tried using the .Login() method for the authentication process instead? That's what i'm using rather than validateuser().
请将 user.[IsApproved] 设置为 true
Please set the user.[IsApproved] to true