如何从ASP.NET中的缓存中删除网页 [英] how to remove a web page from cache in ASP.NET

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

问题描述

我在我的网站上登录,然后当我按后退"按钮时注销bt再次进入登录网页...请给我发送一小段代码...

如何从ASP.NET的缓存中删除网页

i logon in my website then logout bt when i press the back button it again go to login web page...plz send me small piece of code...


how to remove a web page from cache in ASP.NET

推荐答案

您需要将页面标记为不首先缓存.

将这些行添加到html meta部分中

< META HTTP-EQUIV ="CACHE-CONTROL"; CONTENT ="NO-CACHE">
< META HTTP-EQUIV ="EXPIRES"; CONTENT ="0">

并在page_load中编写此

Response.Cache.SetCacheability(HttpCacheability.NoCache);
You need to mark your pages to not be cached in the first place.

Add these lines in the html meta section

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">

and in the page_load write this

Response.Cache.SetCacheability(HttpCacheability.NoCache);


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

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