在会话期间按后退按钮时显示网页已过期 [英] Web Page Expired shown when I press back button during a session

查看:102
本文介绍了在会话期间按后退按钮时显示网页已过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目,我通过以下几行清除了缓存:

I am doing a project in which I have cleared the cache by the following lines :

Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
Response.Expires = -1500;
Response.CacheControl = "no-cache";



我在主页面中使用这些行,这样就不会缓存任何页面,当我在注销后不按下后退按钮时,该页面也没有显示。但即使在按下该页面的过程中也会发生这种情况。后退按钮或前进按钮提供消息网页已过期看起来非常熟悉。这样做的方式应该是即使页面没有被缓存,也是后退按钮不向用户显示所需的消息。


I am using these lines in the master page itself so that none of the page is cached and when I press back button after log out that page does not show.But it happens even during a sessin that pressing the back button or the forward button gives the message "web page expired" which looks very weired .What should be the way of doing this that even the pages are not cached and also the back buttons do not show the weired messge to the users.

推荐答案

将以下代码段放在页面加载事件



Put the following code snippet at page load event

Response.AppendHeader("Cache-Control", "no-store");


这篇关于在会话期间按后退按钮时显示网页已过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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