예제 #1
0
        public ActionResult Login(string username, string password)
        {
            var user = _userManager.Find(username, password);

            if (user == null)
            {
                return(HttpNotFound());
            }
            // success
            var ident = _userManager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie);
            //use the instance that has been created.
            var authManager = HttpContext.GetOwinContext().Authentication;

            authManager.SignIn(
                new AuthenticationProperties {
                IsPersistent = false
            }, ident);
            return(Redirect("/Home"));
        }