Last post Mar 26, 2010 03:47 AM by pinging
Oct 20, 2008 06:15 AM|Positron|LINK
In my application some images are stored in a database while others are physically available on the web server in the folder
The dynamic images have to be made available by using URLs like /gallery/image/x/y/lorem-ipsum.jpg
It easy pretty easy to map in IIS 6 the extension .jpg to the ASP.NET ISAPI (disabling the
Verify file exists option) and then create a custom HTTP Handler that serves the images by pulling the binary data from the database.
However, the problem is that the custom handler now has to process ALL the requests for .jpg resources, while what I am trying to achieve is a selective mapping:
I know that using the path attribute in the httphandlers section of the Web.config allows some degree of flexibility (different handlers for different path) but I cannot manage to revert to the standard IIS behaviour for the requests in
the form /images/*.jpg
In theory I could build another handler that mimics the IIS behaviour for the above requests but as far as I can see, that would come with some issues:
Is there a way to revert to the standard IIS handler for all the .jpg requests that point to resources outside the /gallery/images folder?
Thanks in advance,
http handler iis native images
Oct 20, 2008 08:58 AM|ribalo|LINK
Oct 20, 2008 09:26 AM|Positron|LINK
Thanks for your reply.
Unfortunately in IIS 6 that is not an option.
Feb 20, 2010 07:38 AM|taliesins|LINK
You could use the following handler to serve static content (i.e. the other jpg images). It takes care of all the client side, server side caching issues. It supports resumable downloads. It also caches the images into memory bypassing the hard drive (makes
a huge difference in speed). It also supports gzip and deflate compression (don't use it for images as you get no real benefits from doing it). I think its pretty much on par with IIS serving files. I think the only advantage IIS has is kernel mode caching,
but at least you have fine grained cache control and partial respone caching with the handler.
I would recommend serving all images from this handler and extending it to include custom image generation.
http handler module compression client side caching
Feb 20, 2010 03:58 PM|Positron|LINK
Thanks. This seems very interesting, I'll definitely have look at it!
Mar 26, 2010 03:47 AM|pinging|LINK