本文介绍了如果单击后退按钮,则使上一页过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

大家好,

如果单击浏览器的后退按钮,我试图使上一页过期.我尝试了以下步骤:

步骤#1

Hi All,

I am trying to expire previous page if the back button of browser is clicked. I have tried the following steps:

Step #1

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();



步骤#2



Step #2

<%@ OutputCache Duration="1" NoStore="true" VaryByParam="none" %>



步骤#3



Step #3

Response.Expires = -1;



不幸的是,它们都不起作用.

我该怎么办?

问候
Aman



Unfortunately, None of them work.

How Should I do this?

Regards
Aman

推荐答案

HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
        HttpContext.Current.Response.Cache.SetNoServerCaching();
        HttpContext.Current.Response.Cache.SetNoStore();
        Session.Abandon();

and
Collapse
<script type="text/javascript" language="javascript">
window.history.forward(1);
document.attachEvent("onkeydown", my_onkeydown_handler);
function my_onkeydown_handler()
{
switch (event.keyCode)
{
case 116 : // F5;
event.returnValue = false;
event.keyCode = 0;
window.status = "We have disabled F5";
break;
}
}
</script>




这篇关于如果单击后退按钮,则使上一页过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 19:40