Looking at the SignIn method created by the default ASP.NET MVC 5 project, we can see this code:
private async Task SignInAsync(ApplicationUser user, bool isPersistent) { AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie); AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity); }
What we can notice is that the AuthenticationManager , which is the one who cares about the authentication sign, after we get the identifier, is also needed to log in using the AuthenticationManager . Therefore, perhaps your problem is not related to UserManager .
The AuthenticationManager instance in the Controller class is retrieved using this code:
private IAuthenticationManager AuthenticationManager { get { return HttpContext.GetOwinContext().Authentication; } }
iuristona
source share