Another way to do this (based on other answers, but simplifying it a bit) is to modify Startup.Auth.cs so that it looks something like this:
public partial class Startup { internal static IDataProtectionProvider DataProtectionProvider { get; private set; } public void ConfigureAuth(IAppBuilder app) { DataProtectionProvider = app.GetDataProtectionProvider(); } }
Then change the default constructor in AccountController.cs so that it looks something like this:
public AccountController() : this(new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()))) { if (Startup.DataProtectionProvider != null) { this.UserManager.PasswordResetTokens = new DataProtectorTokenProvider(Startup.DataProtectionProvider.Create("PasswordReset")); this.UserManager.UserConfirmationTokens = new DataProtectorTokenProvider(Startup.DataProtectionProvider.Create("ConfirmUser")); } }
Scott Dorman Oct 26 '13 at 18:09 2013-10-26 18:09
source share