Last post Sep 10, 2006 03:45 AM by vik20000in
Aug 07, 2006 06:20 PM|emer|LINK
I've got a custom built HttpHandler that I use to display the image blobs from the db. I am getting the image straight from the db, resize it if neccessary, cache it and display on the web page. The problem I am having is that, eventhough the images are
being cached in my temp internet folder they are reloaded from the db on each request.
Actually, when i rebuild the complete solution the images get cached and they are also pulled from the cache on each call. but if i use my web app for few minutes, all of the sudden, i get few images here and there that are not being pulled from the cache.
The more I use my web app the more pics quit being loaded from the cache.
i have no clue what am i doing wrong here... Is this a bug and if so how do I fix it?
Why are my images being saved to cache, then being pulled from cache and then just simply quit being pulled from cache?
Images are loaded like this:
<img border="0" src="image.axd?type=Cat1&id=e7810e9f-2abe-4a54-9b58-d82cd2b8fa6d&width=150" />
I cache the image like this in the HttpHandler:
TimeSpan(0, expireInMinutes, 0));
Then I output the image like this:
context.Response.ContentType = picInfo.ContentType;
context.Response.OutputStream.Write(picInfo.PicBytes, 0, picInfo.PicBytes.Length);
Aug 08, 2006 06:34 PM|emer|LINK
Aug 10, 2006 04:30 PM|emer|LINK
anyone have any idea why my dynamic images are first being cached just fine, then after few minutes quit looking for the cached images and reload the dynamic image on each call?
if someone could at least point me in the right direction i'd be gratefull...
Aug 12, 2006 02:20 AM|jhouse|LINK
do you have a memory issue on the server?
I believe cache will be dumped if aspnet doesn't have enough memory to work with?
Aug 14, 2006 04:38 PM|emer|LINK
thanks for replying...
server's got 2GB of RAM. i am basically trying to get all of the images cached in the client's browser cache so that they are not being loaded from the db on each request for that client. i'd like to cache my dynamic images the same way as the image files
are cached in the browser automatically.
i don't really care if the images are saved in the server's cache. i just want them to cache in the client's browser. how can i accomplish this with the dynamic images?
i will appreciate any reply.
Aug 24, 2006 04:10 AM|emer|LINK
should i re-word the problem? i am still looking for an answer
Aug 28, 2006 12:32 PM|webbes|LINK
I think you problem is in:
You should actually get that date from your db and send that back to the browser. Right now you're telling the browser that you've modified the picture just now. The browser response is to get the newly modified version.
Sep 10, 2006 03:45 AM|vik20000in|LINK
Do you know that in asp.net 2.0 any change in the application folder causes the asp.net engine to restart. This can be one reason why you are facing the problem with cache.
check this blog to find how the asp.net request are handled and in which event you can use cache.