How to check user in ASP.NET MVC 5.1.2?
In older versions of MVC 3.4, we had a simple membership. Therefore, we use member.validate (username, password). But everything has changed completely in asp.net mvc 5.
After logging in, for example
await SignInAsync(user, model.RememberMe);
private async Task SignInAsync(ApplicationUser user, bool isPersistent) {
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, await user.GenerateUserIdentityAsync(Manager));
}
There is no previous authentication system. To verify the user, we can do this:
source
share