Cache images provided through script
Posted
by Wim Haanstra
on Stack Overflow
See other posts from Stack Overflow
or by Wim Haanstra
Published on 2010-05-22T13:06:59Z
Indexed on
2010/05/22
13:10 UTC
Read the original article
Hit count: 207
I have a script, which by using several querystring variables provides an image. I am also using URL rewriting within IIS 7.5.
So images have an URL like this: http://mydomain/pictures/ajfhajkfhal/44/thumb.jpg or http://mydomain/pictures/ajfhajkfhal/44.jpg
This is rewritten to: http://mydomain/Picture.aspx?group=ajfhajkfhal&id=44&thumb=thumb.jpg or http://mydomain/Picture.aspx?group=ajfhajkfhal&id=44
I added caching rules to IIS to cache JPG images when they are requested. This works with my images that are REAL images on the disk. When images are provided through the script, they are somehow always requested through the script, without being cached.
The images do not change that often, so if the cache at least is being kept for 30 minutes (or until file change) that would be best.
I am using .NET/C# 4.0 for my website. I tried setting several cache options in C#, but I cant seem to find how to cache these images (client-side), while my static images are cached properly.
© Stack Overflow or respective owner