ShowModalDialog清除缓存

来源:互联网 发布:网络电视机顶盒 编辑:程序博客网 时间:2024/05/28 23:20

有时修改了某些数据,然后通过ShowModalDialog来显示,这时通常显示出来的数据还是上一次的数据。可能ShowModalDialog缓存机制的问题,这时你就需要手动的去清除缓存或者写一些代码……

        HTML方面

在Asp.net页面代码中<head></head>之间添加两行代码

 <meta   http-equiv= "Pragma"   content= "no-cache "> 
 <meta http-equiv="Cache-Control" content="no-cache">

        <meta http-equiv="pragram" content="no-cache">

        禁止浏览器从本地缓存中调阅页面。

        网页不保存在缓存中,每次访问都刷新页面。

        <meta http-equiv="cache-control" content="no-cache, must-revalidate">

        同上面意思差不多,必须重新加载页面

        .NET方面

        pageload()事件中添加如下3行代码

Response.Expires = -1;
Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
Response.CacheControl = "no-cache";

原创粉丝点击