当前位置:编程学习 > C#/ASP.NET >>

网页过期问题

想在网页中实现常见的一种效果,通过a页面跳转到b页面,然后点击浏览器的“后退”按钮后,不要显示a页面,而是给出“网页过期”的提示,网上搜索了一下,基本上是通过下面这种方法设置的:
<meta http-equiv="progma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>

可是,我试验了以下,不起任何作用。

不知道怎么回事,请教!! --------------------编程问答--------------------
<%   
  response.expires   =   0   
  response.expiresabsolute   =   Now()   -   1   
  response.addHeader   "pragma","no-cache"   
  response.addHeader   "cache-control","private"   
  Response.CacheControl   =   "no-cache"(或则设置为Private)   
  %>
这段放在HTML之前 就好
--------------------编程问答--------------------
<meta http-equiv="progma" content="no-cache"/> 
<meta http-equiv="cache-control" content="no-cache"/> 
<meta http-equiv="expires" content="0"/>

这个也是对的呀 怎么会不好使呢 你确定放对位置了吧? --------------------编程问答-------------------- 位置肯定没放错。2楼的那种方法我也实验过了,不行啊。 --------------------编程问答-------------------- 调用 history.back(-1)了么 --------------------编程问答--------------------
引用 2 楼 yan11cn 的回复:
HTML code<metahttp-equiv="progma" content="no-cache"/><metahttp-equiv="cache-control" content="no-cache"/><metahttp-equiv="expires" content="0"/>

up --------------------编程问答-------------------- 那就是人品问题!! --------------------编程问答-------------------- 是清空历史记录造成的。

    private void UnBack()
    {
        Response.Buffer = true;
        Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
        Response.Expires = 0;
        Response.CacheControl = "no-cache";
    }
--------------------编程问答-------------------- 禁止后退
禁止后退 
<META content=no-cache> 
<META http-equiv=Cache-Control content=no-cache> 
<META http-equiv=Expires content=0> 

Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); 
Response.Expires = 0; 
Response.Buffer = true; 
Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1); 
Response.AddHeader("pragma", "no-cache"); 
Response.CacheControl = "no-cache"; 
http://topic.csdn.net/u/20091024/15/ae18d7db-5f82-4a8e-90f0-98dd0fa9d873.html --------------------编程问答-------------------- ^+^
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,