Compartilhar via


<add> Element for <httpModules>

Adds a module to a Web application.

<configuration>
   <system.web>
      <httpModules>
         <add>

<add name="ModuleName"
     type=".NET Class, Assembly [,Version=version number] 
           [,Culture=culture] [,PublicKeyToken=token]"/>

Required Attributes

Attribute Description
name Provides a friendly name for the module. This enables you to associate an event handler for module events within the global.asax file.
type Specifies a comma-separated class/assembly combination consisting of version, culture, and public key tokens. ASP.NET searches for the assembly DLL first in the application's private \bin directory and then in the system assembly cache.

Remarks

The <add> directives are processed in top-down sequential order. If two or more <add> subtags specify the same verb/path combination, the final <add> overrides all others.

Example

The following example adds a module to an application.

<configuration>
   <system.web>
      <httpModules>
         <add name="OutputCache"
              type="System.Web.Caching.OutputCacheModule, System.Web,
                    Version=1.0.2800.0, Culture=neutral,
                    PublicKeyToken=b03f5f7f11d50a3a"/>
      </httpModules>
   <system.web>
</configuration>

Requirements

Contained Within: <system.web>

Web Platform: IIS 5.0, IIS 5.1, IIS 6.0

Configuration File: Machine.config, Web.config

Configuration Section Handler: System.Web.Configuration.HttpModulesConfigurationHandler

See Also

<HttpModules> Element | ASP.NET Configuration | ASP.NET Settings Schema