Reputation: 1817
Im trying to modify the loginsystem that auto-creates when you create a new mvc project on visual studio 2013 sp 3. When i register my user i go to
await SignInAsync(user, isPersisten:false);
Which goes to:
private async Task SignInAsync(User user, bool isPersistent)
{
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
}
Even though my user object is full with info and the ApplicationCookie = ApplicationCookie i still get NullReferenceException on UserManager.CreateIdentityAsync.
Upvotes: 2
Views: 1508
Reputation: 993
Just had this same problem, the fix was updating ASP.NET Identity from 1.0 to 2.1. For me this was two NuGet packages Microsoft.AspNet.Identity.Core and Microsoft.AspNet.Identity.EntityFramework. I then had to create one EF code first database migration that altered several of the ASP.NET Identity database tables, but this went smoothly enough and now everything works.
Upvotes: 2