public void Configuration(IAppBuilder app) { app.CreatePerOwinContext(() => new ShoppingCartContext()); app.CreatePerOwinContext <AppUserManager>(AppUserManager.Create); app.CreatePerOwinContext <RoleManager <AppRole> >((options, context) => new RoleManager <AppRole>( new RoleStore <AppRole>(ShoppingCartContext.Create()))); app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), }); AddUserRoles(); }