清除 ASP.NET 中的页面缓存 [英] Clearing Page Cache in ASP.NET

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

问题描述

对于我的博客,我想使用输出缓存将特定帖子的缓存版本保存大约 10 分钟,这很好...

For my blog I am wanting to use the Output Cache to save a cached version of a perticular post for around 10 minutes, and thats fine...

<%@OutputCache Duration="600" VaryByParam="*" %>

但是,如果有人发表评论,我想清除缓存,以便刷新页面并可以看到评论.

However, if someone posts a comment, I want to clear the cache so that the page is refreshed and the comment can be seen.

如何在 ASP.Net C# 中执行此操作?

How do I do this in ASP.Net C#?

推荐答案

我找到了我一直在寻找的答案:

I've found the answer I was looking for:

HttpResponse.RemoveOutputCacheItem("/caching/CacheForever.aspx");

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

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