Last post Jul 24, 2008 10:11 AM by My Crystal
Jul 24, 2008 04:46 AM|maxp|LINK
Is output caching possible when a request is handled by an ashx (not aspx!) file?
We have an ashx file that handles and serves image requests.
In standard aspx pages you can add '<%@ OutputCache %>' to the markup header to enable output caching, however this is absent from the ashx markup.
Can anyone explain if it is possible to add it?
Have tried the code below with no luck:
//this code still gets hit on every page request
public void ProcessRequest(System.Web.HttpContext context)
byte OutputFile; //contains image bytes
context.Response.ContentType = "image/jpeg";
Jul 24, 2008 09:39 AM|Deleo|LINK
Jul 24, 2008 10:11 AM|My Crystal|LINK
The OutputCacheModule doesn't care about which http handler produces the output, it just cache it if you want it to do so.
i cached the pdf file output in my wetsite, it works.
I suspect other code in your website reset the cache expiration/ Cacheability. Try to find if there is any.