예제 #1
0
        public ActionResult LogOut()
        {
            IOwinContext           ctx         = Request.GetOwinContext();
            IAuthenticationManager authManager = ctx.Authentication;

            //получение текущего пользователя
            ClaimsIdentity claimsIdentity;

            claimsIdentity = HttpContext.User.Identity as ClaimsIdentity;
            string currentUserName = claimsIdentity.Name;

            authManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);

            sessRepo.RemoveSession(new UserSession {
                Name = currentUserName
            });

            return(RedirectToAction("UserDashBoard", "Home"));
        }