Jeroen Swart

.NET Architect

HttpHandler configuration

Sometimes you have a problem for which the solution is so simple and obvious, you can't believe you've overlooked it.

It happened to me a short while ago with an HttpHandler in a website that is using a presentation-service for the presentation-logic (I'll post about this service later). All the pages in the website are dynamically build, based on the results of a call to the presentation-service. The url's don't refer to existing pages and the HttpHandler is supposed to handle all incoming requests. Except, all I got was 404's. I had configured the necessary wildcard mapping, but it took me a while to find that the "Verify that file exists" option was checked. With this option checked, the HttpHandler is only called when the request matches to a physical file on disk. Which of course defeats the purpose of my HttpHandler.

Here's how to correctly configure a wildcard mapping in IIS6:

  1. Open the IIS Manager (Start -> Administrative Tools -> Internet Information Services (IIS) Manager)
  2. Find the node for the website or virtual directory you want to configure (expand the computer node and the Web Sites node if needed)
  3. Right-click the node and select Properties
  4. Select Configuration......
  5. In the Application Extensions list, select the row with extension '.ascx' and click Edit
  6. Make sure the entire content of the Executable field is selected, then right-click inside the Executable field and select Copy; this ensures that we have the correct path to the aspnet_isapi.dll
  7. Select Cancel to close the dialog without changes
  8. Select Insert...
  9. Right-click inside the Executable field and select Paste
  10. Uncheck the Verify that file exists checkbox
  11. Select OK three times to store the new wildcard application mapping and to close all the dialogs
  12. The configuration is finished, you can close the IIS Manager