Caching the response of an ASP.NET HTTP Handler server and client side
- by Bert Vandamme
Is it possible to cache the response of a http handler on the server and on the client?
This doesn't seem to be doing the trick:
_context.Response.Cache.SetCacheability(HttpCacheability.Public);
_context.Response.Cache.SetExpires(DateTime.Now.AddDays(7));
The _context is the HTTPContext passed as an argument to the ProcessRequest method on the IHttpHandler implementation.
Any ideas?
Update: The client does cache images that are loaded through the httphandler, but if another client does the same call, the server hasn't got it cached. So for each client that asks for the image, the server goes to the database (and filestream). If we use a aspx page instead of a httphandler together with a caching profile, then the images are cached both on the client and the server.