我如何从缓存中删除页面 [英] how can i remove page from cache

查看:117
本文介绍了我如何从缓存中删除页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好总经理,

在网站上,
我有登录页面,登录后可以访问以修改我的母版.

我的问题是
登录后,我转到首页等其他页面并返回上一页(使用浏览器的后退链接)
然后它会在我登录后显示的页面上显示我离开的页面(即可以修改母版)

那么我该如何从缓存中删除页面,在浏览器的反向链接上它应该再次显示登录页面?

hello GM,

in website ,
i have log in page, after i log in i get to access to modify my masters.

my problem is
after log in i go to another page like home etc & come back to previous page (using back link of browser)
then it shows me page after login on which i leave (i.e. can modify master)

then how can i remove page from cache , on browser back link it should display again login page?

推荐答案

您可以使用以下代码删除该页面的提及将不会被缓存.

You can use the following code to remove the mention that the page wont be cached.

var lastModified = DateTime.UtcNow;
var expires = lastModified - TimeSpan.FromDays(365);

Response.Cache.SetExpires(expires);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();

Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");


这篇关于我如何从缓存中删除页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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