programatically clearing the outputcache

  • Thread starter Thread starter David Lozzi
  • Start date Start date
D

David Lozzi

Howdy,

How do I forcibly clear out the cache for entire web application? I want to
give my customer the option to clear the cache after any major data updates
they may do.

Thanks!

David Lozzi
 
Hello David,

Use the Response class to clear the cache

Response.Expires = 0
Response.CacheControl = "no-cache"
Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache)
Response.Cache.SetNoStore()
Response.Buffer = True
Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
Response.AppendHeader("Pragma", "no-cache")
Response.AppendHeader("", "")

if it doesnt help then u need to restart IIS - there is no API for this.
u need to kill the process programmatically



---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


DL> Howdy,
DL>
DL> How do I forcibly clear out the cache for entire web application? I
DL> want to give my customer the option to clear the cache after any
DL> major data updates they may do.
DL>
DL> Thanks!
DL>
DL> David Lozzi
DL>
 
Back
Top