How to validate user in ASP.NET MVC 5.1.2 ?
In older versions of MVC 3,4 we had simple membership. So we do use membership.validate(user.name,password). But things have changed completly in asp.net mvc 5.
After programmatic login like
await SignInAsync(user, model.RememberMe); // after login HttpContext.Current.User.Identity.IsAuthenticated is false . Odd.
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 validate a user we can do this :