
Registering the HTTP Module in IIS 6.0 and IIS 7.0 Classic Mode
After you have created the HelloWorldModule class, you register the module by creating an entry in the Web.config file. Registering the HTTP module enables it to subscribe to request-pipeline notifications.
In IIS 7.0, an application can run in either Classic or Integrated mode. In Classic mode, requests are processed basically the same as they are in IIS 6.0. In Integrated mode, IIS 7.0 manages requests by using a pipeline that enables it to share requests, modules, and other features with ASP.NET.
The procedure for registering a module is different in IIS 7.0 Classic mode and IIS 7.0 Integrated mode. This section describes the procedure for IIS 6.0 and IIS 7.0 Classic mode. The procedure for registering a module that is running in IIS 7.0 Integrated mode is described in the next section.
To register the module for IIS 6.0 and IIS 7.0 running in Classic mode
If the Web site does not already have a Web.config file, create one under the root of the site.
Add the following highlighted code to the Web.config file:
|
<configuration>
<system.web>
<httpModules>
<add name="HelloWorldModule" type="HelloWorldModule"/>
</httpModules>
</system.web>
</configuration>
|
The code registers the module with the class name and the module name of HelloWorldModule.