
448
|
Chapter 20: web.config Reference
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
<httpModules>
<httpModules>
<add
name=moduleName
type=typeInfo />
<remove name=moduleName />
<clear />
</httpModules>
Adds or removes HttpModules. HttpModules are special classes that participate in
the processing of all application requests. Both ASP.NET caching and session
state are implemented as HttpModules, as are the authentication and authoriza-
tion features of ASP.NET.
Scope
Any
Attributes
None
Child Elements
<add>
Adds an HttpModule. The class that implements the HttpModule is speci-
fied by the
type attribute. This class must implement the IHttpModule
interface. The
name attribute provides an alias by which the HttpModule can
be referenced—for example, in a later
<remove> element.
<remove>
Removes a previously configured HttpModule, based on the specified
name
attribute. The attribute must match a previously configured <add> element.
<clear>
Clears all previously configured HttpModules.
Example
The example removes the HttpModule for the Session state provider, which can
be useful if you’re not using it:
<configuration>
<system.web>
<httpModules>
<remove name="Session" />
</httpModules>
</system.web>
</configuration>
Notes
If you’re not using a particular HttpModule, such as the Session state module or
authentication modules, you may be able to save overhead ...