如何在注销时禁用浏览器后退按钮? [英] how to disable browser back button on logout ?
本文介绍了如何在注销时禁用浏览器后退按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经厌倦了以下代码
I have tired the below code
public class NoCacheAttribute : ActionFilterAttribute
{
public override void OnResultExecuting(ResultExecutingContext filterContext)
{
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
filterContext.HttpContext.Response.Cache.SetValidUntilExpires(false);
filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
filterContext.HttpContext.Response.Cache.SetNoStore();
base.OnResultExecuting(filterContext);
}
}
[NoCache]
public ActionResult Logout()
{
Session.Clear();
Session.Abandon();
return RedirectToAction("Login", "UserProfile");
}
但这不起作用,任何人都可以引导我
but this is not working, can anyone plz guide me
推荐答案
看到在codeproject用户中解决了同样的要求:
一切顺利
注销后禁用浏览器的后退功能 [ ^ ]
see this same requirement solved in codeproject users :
all the best
Disabling browser’s back functionality after logout[^]
正确使用会话你的索引页面,即基页使用脚本函数作为Windows.history.forward()
希望这样做。它在我的演示中工作
Happy Coding
Use Sessions Correctly and in your Index page, i.e. the base page use a script function as Windows.history.forward()
Hope this works out. It worked in my demos
Happy Coding
看看注销后的浏览器后退按钮问题 [ ^ ]。
这篇关于如何在注销时禁用浏览器后退按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文