Search code examples
c#asp.netoutputcache

Clearing Page Cache in ASP.NET


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.

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


Solution

  • I've found the answer I was looking for:

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