A lot of people (at least half a dozen individuals within the past couple of weeks) have privately asked me for sample code to extend IIS 6 behavior in the following contexts:

  1. Want to write a protocal handler (such as WebDAV) on IIS in managed code
  2. Want to change/redirect URL processing by IIS using managed code
  3. Want to implement a custom security solution for IIS in managed code

Basically, things that one would usually handle with native ISAPI Filters and ISAPI Extensions, but now using managed code, preferably ASP.Net.

Well, your questions have catalyzed one of the long-standing articles that I have wanted to write - how to extend IIS 6 capabilities using managed code... and contrast how much easier and unified it will be in IIS 7.

This is definitely going to be a series of technical posts where I will try to give lots of sample code and synthesize technical information not found in normal documentation, so I am just going to start brain-dumping. It seems a bit haphazard to me, but I think you probably want the details ASAP in chunks, and not wait for the completely edited article series post a couple of weeks/months later..., so please feel free to immediately post comments if you want more details, different explanations, related ideas, etc, and I will definitely try to accommodate. These posts are to help you.

In the series, I plan to explore the details of extending IIS 6 with managed code, gather up and synthesize concise information from the designers and developers of various parts of IIS 6 and ASP.Net themselves, point out subtle nuances, and in the end, produce a road-map of how to extend IIS6 capabilities using managed code... and then tell you how it is going to be way better in IIS 7. :-)

Now, where should we begin. Oh, yes, a preliminary outline of what I am considering for topics in the series:

  • Conceptual IIS 6 Request Pipeline (and why managed code extension does not work on earlier IIS versions like IIS 5)
  • Conceptual ASP.Net Request Pipeline (and why managed code extension requires ASP.Net 2.0 to work)
  • Sample Code using managed code to extend IIS 6, showing how to capture and respond to arbitrary HTTP Verbs, change aspects of the request like the URL, and filter incoming requests to control
  • How IIS 7 improves the experience

I will note that all of these behaviors can be handled by ISAPI Extension and ISAPI Filter DLLs written in native code. The reason why managed extensibility requires IIS 6 and ASP.Net 2.0 is due to the timing of IIS Request Pipeline features and ASP.Net exposure/integration of those same features.

Thus, we are going to start by looking at the IIS 6 Request Pipeline.

To be continued...