Map All Requests to ASP.NET ISAPI Filter
I was doing some URL rewriting fun today and ran into problems when I discovered my .htm, .html and anything non-asp.net were not being rewritten. Then I thought…duuuuh, the asp.net isapi filter isn’t configured for anything other than the native asp.net file extensions (aspx, ashx, asmx, etc). After playing with IIS 7 and continually clicking “ISAPI Filters” only to my dismay finding what I was not looking for, my pointer finally found its way to “Handler Mappings”. And from there I added a new Wildcard Script Map and vuala, URL rewriting was back in business. So, if you ever run into this, save yourself some time and just go straight into the web.config and if you are running IIS 7 add the following configuration to system.webserver / handlers.
<add name="ASP.NET Map" path="*" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
Here are the steps if you want to manage it through IIS:
- Open IIS and select your application
- Click Handler Mappings
- On the right-hand side, click “Add Wildcard Script Map”
- Enter “%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll” in the Executable. (This may be different depending upon what version of the framework you are using.)
- Enter a name
- Click OK
.matti