IIS7 (and the tooling around it) has wonderful new features. First of all managed code is now a first class citizen and can do (nearly) everything as the unmanaged API. Almost everything that could be accomplished by ISAPI filters and extensions is now possible with .NET HttpModules/HttpHandlers. Next IIS7 allows to seamlessly integrate your custom functionality with the configuration and management system. This includes the configuration file, the administration GUI and remote management features.
I wanted to test drive the new APIs so I decided to build a module that can change the value of the Server HTTP Header so that IIS can look to scanners like an Apache or whatever you want (I did this ages ago using an ISAPI filter). My module should feel like a built-in IIS feature with regards to configuration and management.
This scenario allows testing several new features of IIS7, e.g.
- (ASP).NET code can change response headers even if they are not originating from the same “handler” (this also applies to request headers and server variables – btw)
- Processing of all requests
- Integration into the unified configuration system and feature delegation. The configuration section of the ServerHeader feature will live under <system.webServer>
- Integration into the IIS7 GUI and the remote administration infrastructure
This was not hard to do, but it turns out that the whole solution is quite some code (mostly for the UI integration plumbing) – so I will split the walkthrough in several logical parts and explain the underlying concepts while we go. I plan to talk about the following topics:
- The HttpModule
- Management Integration (on the server)
- Management (aka UI) Integration (on the client)
- Wrap up and Solution Structure
Watch this space.