我正在关注此帖子Session of the user in mvc。我的要求是,当用户从asp.net mvc应用程序注销时,如果他单击后退按钮,则不应将其重定向到上一页。用户应保留在登录页面上。我已经尝试了以上线程的注销代码,如下所示。
public ActionResult LogOut()
{
FormsAuthentication.SignOut();
Session.Abandon(); // it will clear the session at the end of request
return RedirectToAction("Login", "User");
}
答案 0 :(得分:1)
[Authorize]
public class HomeController: Controller
{
public ActionResult YourTable()
{
return View();
}
}
在控制器中使用授权
另一种方法是:禁用整个应用程序的缓存
请参阅:After logout if browser back button press then it go back last screen