用户锁定在.NET 4.5.1 ASP.NET MVC 5

编程入门 行业动态 更新时间:2024-10-22 23:38:24
本文介绍了用户锁定在.NET 4.5.1 ASP.NET MVC 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

因此​​,在新的.Net框架4.5.1 AspNetUser表没有列锁定用户出有限数目的不成功尝试后。是否有专为目的,以取代曾经在previous .NET框架中存在的功能框架或解决方案?还是我必须建立自己的

So in the new .Net Framework 4.5.1 AspNetUser table does not have a column to lock user out after a finite number of unsuccessful attempts. Are there frameworks or solutions built for that purpose to replace the functionality that once existed in previous frameworks? Or do I have to build my own?

推荐答案

在即将到来的2.0版本的身份,有一个帐户锁定的支持

In the upcoming 2.0 Identity release, there is support for Account Lockout

配置:

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

更多推荐

用户锁定在.NET 4.5.1 ASP.NET MVC 5

本文发布于:2023-06-04 19:09:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/503360.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用户   NET   ASP   MVC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!