0
我使用的代码下面一行用asp.net MVC4.
浏览器后退按钮问题iasp.net MVC4
[OutputCache(NoStore = false, Duration = 0, VaryByParam = "None")]
public ActionResult Logout()
{
try
{
if (Session["username"] != null)
{
Session.Abandon();
Session.Clear();
Session.RemoveAll();
Session["username"] = null;
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();
return RedirectToAction("Index", "AdminPanel");
}
return RedirectToAction("Error", "Home");
}
catch (Exception e)
{
return RedirectToAction("Error", "Home");
}
}
禁用注销后浏览器后退按钮问题,但是,有一个问题与此代码,假如我”第三页第一页是登录页面(Index.cshtml)
,第二页登录页面(home.cshtml)
,第三页页面是(about.cshtml)
页面,现在我登录了,然后它会重定向到home.cshtml
页面,我现在转到第三页about.cshtml,然后我请从about.cshtml
页面注销,它会将我重定向到login.cshtml
页面。现在,如果我点击浏览器后退按钮,然后重新定向about.cshtml
页面,但用户无法更改或添加任何内容。 因此,让我知道是否有任何适当的代码或方法来解决这个问题。