asp.net-mvc – 如何在MVC6或AspNet Core或IdentityCore中更改PasswordVal
发布时间:2020-05-24 21:34:36 所属栏目:asp.Net 来源:互联网
导读:在使用Identity的Asp.Net MVC 5中,可以执行以下操作: manager.PasswordValidator = new PasswordValidator { RequiredLength = 6, RequireLowercase = true, Requir
|
在使用Identity的Asp.Net MVC 5中,可以执行以下操作: manager.PasswordValidator = new PasswordValidator
{
RequiredLength = 6,RequireLowercase = true,RequireDigit = false,RequireUppercase = false
};
如何在MVC 6中更改相同的配置? 我看到可以在段中的ConfigurationServices方法中: services.AddIdentity<ApplicationUser,IdentityRole>()
.AddPasswordValidator<>()
但我无法使用. 解决方法解决方案Beta6在Startup.cs中编写代码: services.ConfigureIdentity(options =>
{
options.Password.RequireDigit = false;
options.Password.RequiredLength = 6;
options.Password.RequireLowercase = false;
options.Password.RequireNonLetterOrDigit = false;
options.Password.RequireUppercase = false;
});
更新Beta8和RC1 // Add Identity services to the services container.
services.AddIdentity<ApplicationUser,IdentityRole>(options =>
{
options.Password.RequireDigit = false;
options.Password.RequiredLength = 6;
options.Password.RequireLowercase = false;
options.Password.RequireNonLetterOrDigit = false;
options.Password.RequireUppercase = false;
})
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
更新RC2 // Add Identity services to the services container.
services.AddIdentity<ApplicationUser,IdentityRole>(options =>
{
options.Password.RequireDigit = false;
options.Password.RequiredLength = 6;
options.Password.RequireLowercase = false;
options.Password.RequireNonAlphanumeric= false;
options.Password.RequireUppercase = false;
})
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders(); (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 什么是强类型的视图在ASP.NET MVC
- ASP.NET如何确定是否排队请求?
- asp-classic – Response.Write和%=%
- 处理global.asax ASP.NET MVC中的异常
- MVC3中的IValidatableObject – 客户端验证
- asp.net-mvc – 在Razor web helper中使用html助手
- asp.net-mvc-4 – 如何在iframe src中使用Url.Action
- asp.net – 为什么WebMethod访问会话状态没有EnableSession
- .net – IIS 6.0和ASPX中的404自定义错误不起作用
- asp.net-mvc-3 – Telerik MVC网格,在运行时从集合或字典中
推荐文章
站长推荐
- asp.net-mvc – 如何在我的MVC应用程序有机会处理
- asp.net-mvc – 在实体框架代码中为同一表定义多
- asp.net – 为什么javascript onchange事件不触发
- asp.net使用DataTable构造Json字符串的方法
- asp.net-core – 使用.NET Core时需要AssemblyIn
- asp.net – jQuery AJAX vs. UpdatePanel
- asp.net – Response.TrySkipIisCustomErrors不工
- asp.net – w3wp.exe占用多少内存
- 为什么我的内联asp.net无法正常工作?
- asp.net – 如何防止Azure网站进入睡眠状态?
热点阅读
