【问题标题】:ASP.NET5 beta8 IServiceCollection changesASP.NET 5 beta 8 IServiceCollection 更改
【发布时间】:2016-01-15 09:40:03
【问题描述】:

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

所以之前写的代码就像

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

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

不能再编译了。

谷歌搜索没有结果,我想是因为距离 beta8 发布仅过去了一天。

有没有人找到解决方法? beta8应该如何配置身份选项?

【问题讨论】:

    标签: c# asp.net asp.net-identity asp.net-core


    【解决方案1】:

    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

    【讨论】:

    • 谢谢,这正是我想要的。希望对遇到此类迁移问题的其他人有所帮助。
    猜你喜欢
    • 2016-01-18
    • 2016-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多