asp.net.ph

Skip Navigation Links

<httpModules> Section

ASP.NET Syntax   ASP.NET Configuration Sections


Configures the HTTP modules within an application.

<httpModules>

   <add name = "modulename"
      type = "classname,assemblyname" />

   <remove name = "modulename"
      type = "classname,assemblyname" />

   <clear />

</httpModules>

The <httpModules> tag supports three subtags.

Subtag Description
<add> Adds an HttpModule class to an application.

Note that if an identical verb/path combination has been specified earlier ( for example in a Web.config file in a parent directory ), the second call to <add> overrides the previous setting.

The <add> subtag supports two attributes.

Attribute Description
type Specifies a comma-separated class/assembly combination. ASP.NET searches for the assembly DLL first in the application’s private \bin directory and then in the system assembly cache.
name Specifies the name that application code uses to refer to the module identified by type.

Subtag Description
<remove> Removes an HttpModule class from an application.

The <remove> subtag supports two attributes.

Attribute Description
type Specifies a comma-separated class/assembly combination. ASP.NET searches for the assembly DLL first in the application’s private /bin directory and then in the system assembly cache.
name Specifies the name that application code uses to refer to the module identified by type.

Subtag Description
<clear> Removes all HttpModule mappings from an application.

Syntax Example

The following example adds three HttpModules to the ASP.NET application.

<configuration>
   <system.web>
      <httpModules>
         <add type = "System.Web.State.OutputCacheModule"
            name = "OutputCache" />
         <add type = "System.Web.State.SessionStateModule"
            name = "Session" />
         <add type=Selector, selector.dll"
            name = "Selector" />
      </httpModules>
   </system.web>
</configuration>
See Also

ASP.NET Configuration   HttpModulesSection Class



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note