页面在每个浏览器上过期

时间:2014-05-09 10:13:59

标签: c# asp.net .net

我有一个表单,一旦我提交了一个感谢页面。单击指向新页面的链接,然后返回到感谢页面(通过按回)页面,然后显示页面过期。这发生在所有浏览器上。如何让它显示感谢页?

HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();

1 个答案:

答案 0 :(得分:0)

您有两个选择:

检查表单页面上的Page_Load,并设置cookie / session / DB检查,任何你喜欢的内容。设置一个条件,如果表单已经提交,那么重定向到感谢页面

停止后退按钮,这在某些浏览器上支持。 您可以从后退按钮中清除历史记录,这样会很好。 您也可以在表单页面

中添加它
<script type="text/javascript" language="javascript">
            javascript:window.history.forward(1);
    </script>