所以在新的.Net框架4.5.1 AspNetUser表没有一个列来锁定用户在有限数量的不成功的尝试后.是否为此建立了框架或解决方案来替代先前.net框架中曾存在的功能?还是要建立自己的?
@H_301_2@
解决方法
在即将发布的2.0身份版本中,支持帐号锁定
组态:
manager.UserLockoutEnabledByDefault = true; // Enables ability to lockout for users when created manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5); manager.MaxFailedAccessAttemptsBeforeLockout = 5;
用法:
manager.IsLockedOutAsync(user.Id) // Check for lockout manager.ResetAccessFailedCountAsync(user.Id); // Clear Failed count after success manager.AccessFailedAsync(user.Id); // Record a failure (this will lockout if enabled) manager.SetLockoutEnabled(user.Id,enabled) // Enables or disables lockout for a user@H_301_2@ @H_301_2@