问题
I have followed to the following article as best I can by Rick Anderson: MVC 5 App with Facebook, Twitter, LinkedIn and Google OAuth2 Sign-on
I am trying to get Google Authentication tested and working on my local machine...
Startup.Auth.cs is as follows (exactly as per article this time):
// Configure the db context and user manager to use a single instance per request
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
// Enable the application to use a cookie to store information for the signed in user
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
// Configure the sign in cookie
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
There error is The type or namespace name 'ApplicationUserManager' could not be found.
Do we have to go creating the ApplicationUserManager? (like described here: http://blogs.msdn.com/b/webdev/archive/2014/02/18/10499038.aspx
Or better:
Where us ApplicationUserManager? Is there a nuget package that should have created it?
I read in different places that ApplicationUserManager used to be in IdentityConfig.cs, but IdentityConfig.cs is no longer there if you stick to current nuget packages.
回答1:
I had the same issue. I have been following a tutorial but I started the MVC 5 project from VS 2012 with an empty project. I think that the creator of the tutorial used a different template that already contained what I found in NuGet.
It is the following:
来源:https://stackoverflow.com/questions/26525641/the-type-or-namespace-name-applicationusermanager-could-not-be-found