Image Resizer - Configuring IIS
Wednesday, August 06, 2008
Installing on IIS 5 & IIS 6
The ImageResizingHandler is part of the ASP.NET application, so we must configure IIS to pass requests for .jpg, .png, and .gif files to the ASP.NET runtime. By default IIS serves these files itself.
We have two choices: a wildcard mapping, or individual mappings for the three extensions. If you plan on doing URL rewriting and having extension-free paths, then you are going to need a wildcard mapping anyway. If you want IIS to handle as much as possible and you don't need to control file access at the ASP.NET layer, then you can go with individual mappings.
1) Open IIS, right-click on your web site, and choose properties.
2) Click the "Home Directory" tab, then "Configuration"
3a) For individual mappings, click "Add" for each extension. Add ".jpg", ".png", ".jpeg", ".bmp",".tiff", and ".gif". The executable path should match the executable path from ".aspx". For .Net 2.0, that's "C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll". Make sure "Script Engine" is checked. "Verify file exists" will need to be unchecked if you plan to do any URL rewriting.
3b) For a wildcard mapping on IIS 5, add extension ".*" the same as you would any other extension. For IIS 6, choose "Insert" and add the aspnet_isapi.dll executable inside the wildcard applications maps area. For both IIS 5 and 6, make sure "Script Engine" is checked. "Verify file exists" will need to be unchecked if you plan to do any URL rewriting, but should be left checked if you are using the default documents feature of IIS. (URL rewriting with the UrlRewriting.Net library provides much more power than IIS default documents. I highly recommend it).
Installing on IIS 7 classic mode
IIS 7 mode mappings are done in web.config
Individual
...
...
Wildcard
...
...