页面在每个浏览器上都会过期

本文关键字:过期 浏览器 | 更新日期: 2023-09-27 18:02:27

我有一个表单,当我提交去一个感谢页面。当点击一个链接到一个新的页面,然后回到感谢页面(按回),然后页面显示一个页面过期。这在所有浏览器上都会发生。我怎样才能让它显示感谢页面呢?

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();

页面在每个浏览器上都会过期

你有两个选择:

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

停止后退按钮,这在某些浏览器上支持。你可以从后退按钮清除历史记录,这将是很好的去。你也可以把它添加到你的表单页

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