注销后如何禁用浏览器后退按钮 [英] How to disable browser back button after logged out

查看:105
本文介绍了注销后如何禁用浏览器后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在使用链接按钮注销选项.该页面将重定向到登录页面.在此浏览器之后,后退和前进按钮要禁用.不想再次显示登录页面.

"Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);"

我尝试了这段代码.但它不起作用.你能帮我吗?

谢谢
问候,
Sangeetha

Hello,

I am using link button for log out option. The page will redirect to login page. After this browser back and forward buttons want to disable. Don''t want to display the logged in page again.

"Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);"

I tried this code. But its not work. Can you please help me?

Thank you,
Regards,
Sangeetha

推荐答案

Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
        Response.AddHeader("pragma", "no-cache");
        Response.AddHeader("Cache-Control", "no-cache");
        Response.CacheControl = "no-cache";
        Response.Expires = -1;
        Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
        Response.Cache.SetNoStore();

         Page.ClientScript.RegisterStartupScript(this.GetType(), "cle", "windows.history.clear", true);


Or Use this JavaScript


Or Use this JavaScript

<script> 
function noBack(){window.history.forward();}
noBack();
window.onload=noBack;
window.onpageshow=function(evt){if(evt.persisted)noBack();}
window.onunload=function(){void(0);}
</script>


查看更多信息


看看以下内容:

http://msdn.microsoft.com/en-us/library/532aee0e(VS.71).aspx [^] [ ^ ]
点击退出按钮后,禁用浏览器后退按钮功能 [^ ]
have a look at the following:

http://msdn.microsoft.com/en-us/library/532aee0e(VS.71).aspx[^][^]
Disable Browser Back Button functionality after click on Logout Button[^]


在注销事件中使用
History.Forward()

.


这篇关于注销后如何禁用浏览器后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆