Click to See Complete Forum and Search --> : [RESOLVED] programmatically set or remove outout cache


dannystommen
June 24th, 2009, 08:11 AM
I have a page that creates an image dynamically. When everything works fine, I write the generated image to the Response.OutputStream. When I catch an exception, I write an 'error'image to the outputstream.

I want this page to be cached, but only if everything went ok. Otherwise the errorimage will always be shown.

Thus what I'm looking for is a replacement of the <%@ OutputCache %> tag in the top of the page.

dannystommen
November 19th, 2009, 09:57 AM
After a long time, I found it out


Response.Cache.SetNoStore();
//or
Response.Cache.SetExpires(DateTime.Now.AddDays(7));
//and so the Response.Cache has even more methods