'ApplicationSignInManager' 未找到(ASP.NET MVC)

'ApplicationSignInManager' not found (ASP.NET MVC)

我正在学习此 link 中的教程:

https://www.codeproject.com/Articles/806029/Getting-started-with-AngularJS-and-ASP-NET-MVC-Par

但是,当我按照文章中的说明进行操作时,教程中指定的 ApplicationSignInManager class 在我正在构建的项目中并不存在。我试图在搜索引擎中寻找可能的答案,但没有找到任何答案。我只是想知道在哪里可以找到包含此 class 的 dll,以便我可以将其包含到我的项目中并继续教程。

通常 ApplicationSignInManager 是您项目的一部分,仅继承自 SignInManager<TUser, TKey>。应该这样做:

using System;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using Microsoft.Owin.Security;

public class ApplicationSignInManager : SignInManager<ApplicationUser, Guid>
{
    public ApplicationSignInManager(UserManager userManager, IAuthenticationManager authenticationManager)
        : base(userManager, authenticationManager)
    {
    }

    public static ApplicationSignInManager Create(IdentityFactoryOptions<ApplicationSignInManager> options, IOwinContext context)
    {
        return new ApplicationSignInManager(context.GetUserManager<UserManager>(), context.Authentication);
    }
}

也许你应该在原始资源上问这个问题。

感谢@trailmax,我刚刚找到了它的原始来源。项目文件也从一开始就附加到教程中。它就在 IdentityConfig.cs 文件下。这是它的实现方式:

IdentityConfig.cs

public class ApplicationSignInManager : SignInManager<ApplicationUser, string>
{
    public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager)
        : base(userManager, authenticationManager)
    {
    }

    public override Task<ClaimsIdentity> CreateUserIdentityAsync(ApplicationUser user)
    {
        return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager);
    }

    public static ApplicationSignInManager Create(IdentityFactoryOptions<ApplicationSignInManager> options, IOwinContext context)
    {
        return new ApplicationSignInManager(context.GetUserManager<ApplicationUserManager>(), context.Authentication);
    }
}