Hello,
I am migrating an IIS6 website to IIS7 and I am hitting the well known problem of mixing a global ASP.NET handler while using default documents. See here for details:
Right now, in IIS7, I have the following modules configured, where "Everything" has a global.asax rewriting a lot of queries.
[... All default app modules ...]
<add name="StaticFile" path="*.*" verb="*" type="" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" scriptProcessor="" resourceType="Either" requireAccess="Read" allowPathInfo="false" preCondition="" />
<add name="Everything" path="*" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.SimpleHandlerFactory" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" />
With this configuration, default documents do not work because of "StaticFile" wildcard. My set of constraints is something like:
- Have all non-static requests handled by "Everything" global.asax for rewriting.
- Do not change global.asax code because it is complicated (we will tidy it up later).
- Have default documents for existing directories
- Do not handle static files in "Everything"
- Use IIS7 integrated mode
My current understanding is it cannot be done with this setup. So, one tradeof would be to move the global.asax rewriting code in an IHttpModule, registered after the static files. What's sad is it requires a separate assembly instead of editing the project directly. And I don't know how it will behave with Cassini.
What do you think? Is the IHttpModule the right approach? Could it be simpler?