gpt4 book ai didi

c# - ASP.NET5 beta8 IServiceCollection 更改

转载 作者:行者123 更新时间:2023-12-03 21:26:58 25 4
gpt4 key购买 nike

将我的项目更新到最近发布的 ASP.NET 5 beta8 后,我发现 IServiceCollection 不再包含 ConfigureIdentityConfigureIdentityApplicationCookie 的定义.

所以之前写的代码就像

services.ConfigureIdentity(o =>
{
o.Password.RequireUppercase = false;
o.Password.RequireNonLetterOrDigit = false;
});

services.ConfigureIdentityApplicationCookie(o => o.LoginPath = "/Admin/Users/Login");

无法再编译。

Google 搜索没有结果,我想是因为 beta8 发布才过去一天。

有人找到解决这个问题的方法吗? beta8 中应该如何配置身份选项?

最佳答案

Configure*方法被删除,Add*方法现在接受 Action<TOptions> :

services.AddIdentity<TUser, TRole>(o =>
{
o.Password.RequireUppercase = false;
o.Password.RequireNonLetterOrDigit = false;
o.Cookies.ApplicationCookie.LoginPath = "/Admin/Users/Login";
});

不完全相关,但部分相关:https://github.com/aspnet/Announcements/issues/71

关于c# - ASP.NET5 beta8 IServiceCollection 更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33173803/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com