lockout

MVC 5 Identity 2.0 lockout doesn't work

白昼怎懂夜的黑 提交于 2019-12-21 12:24:52
问题 I need to block a user permanently. I don't understand why this code is not working. This line UserManager.IsLockedOut(user.Id); always returns false instead of true . Maybe it's necessary to put this line UserManager.UserLockoutEnabledByDefault = true; in user registration stage? using (var _db = new ApplicationDbContext()) { UserStore<DALApplicationUser> UserStore = new UserStore<DALApplicationUser>(_db); UserManager<DALApplicationUser> UserManager = new UserManager<DALApplicationUser>

Locking out a user in an ASP .Net Custom Membership Provider

我的梦境 提交于 2019-12-04 12:07:26
问题 I've had to create a custom membership provider for my current ASP .Net project in order to fit in with our database schema, and am having problems configuring it to lockout a user if they get their password wrong three times, as is supported by the standard providers. Is this something I need to implement myself, or should it be supported inherently? I have no code that specifically deals with it (and none of the interface members seem to deal with it specifically), but if I need to

MVC 5 Identity 2.0 lockout doesn't work

巧了我就是萌 提交于 2019-12-04 07:38:36
I need to block a user permanently. I don't understand why this code is not working. This line UserManager.IsLockedOut(user.Id); always returns false instead of true . Maybe it's necessary to put this line UserManager.UserLockoutEnabledByDefault = true; in user registration stage? using (var _db = new ApplicationDbContext()) { UserStore<DALApplicationUser> UserStore = new UserStore<DALApplicationUser>(_db); UserManager<DALApplicationUser> UserManager = new UserManager<DALApplicationUser>(UserStore); UserManager.UserLockoutEnabledByDefault = true; DALApplicationUser user = _userService