public IActionResult Login(AccountView account) { AccountView accountView = AccountDTO.Login(account.Email, account.Password); if (accountView != null) { SercurityManager.Login(this.HttpContext, accountView); return(RedirectToAction("index", "home")); // Chỗ quan trọng: bắt buộc return Redirect để refresh lại trang (refresh lại httpContext, nó mới nhận được cookie, nhiều người chỉ để return View() => ko nhận được cookie) } else { ViewBag.Error = "Error: Sai tên tài khoản hoặc mật khẩu."; return(View("login")); } }