Share via


httpModules-Element (ASP.NET-Einstellungsschema)

Konfiguriert die HTTP-Module innerhalb einer Anwendung. Dieses Element kann auf jeder Ebene der Konfigurationshierarchie deklariert werden.

<httpModules> 
   <add... />
   <remove... />
   <clear/>
</httpModules>

Attribute und Elemente

In den folgenden Abschnitten werden Attribute, untergeordnete Elemente und übergeordnete Elemente beschrieben.

Attribute

Keine.

Untergeordnete Elemente

Element

Beschreibungen

add

Optionales Element

Fügt einer Anwendung ein httpModules-Element hinzu.

clear

Optionales Element

Entfernt alle httpModules-Elemente aus einer Anwendung.

remove

Optionales Element

Entfernt einen Verweis auf ein httpModules-Element.

Der Wert muss genau mit dem einer vorherigen add-Direktive übereinstimmen.

Übergeordnete Elemente

Element

Beschreibung

configuration

Gibt das erforderliche Stammelement in jeder Konfigurationsdatei an, die von der Common Language Runtime und den .NET Framework-Anwendungen verwendet wird.

system.web

Gibt das Stammelement für den ASP.NET-Konfigurationsabschnitt an.

Hinweise

Standardkonfiguration

Das folgende httpModules-Standardelement wird in der Datei Machine.config in .NET Framework, Version 1.1, konfiguriert.

<httpModules>
     <add name="OutputCache" type="System.Web.Caching.OutputCacheModule"/>
     <add name="Session" type="System.Web.SessionState.SessionStateModule"/>
     <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule"/>
     <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule"/>
     <add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule"/>
     <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule"/>
     <add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule"/>
     <add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile, 
          Version=1.0.5000.0, Culture=neutral, 
          PublicKeyToken=b03f5f7f11d50a3a"/>
</httpModules>

Das folgende httpModules-Standardelement wird in der Datei Machine.config in .NET Framework, Version 1.0, konfiguriert.

<httpModules>
     <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
     <add name="Session" type="System.Web.SessionState.SessionStateModule" />
     <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
     <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
     <add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule" />
     <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
     <add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" />
</httpModules>

Das folgende httpModules-Standardelement wird in der Stammdatei Web.config in .NET Framework, Version 2.0, konfiguriert.

<httpModules>
     <add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
     <add name="Session" type="System.Web.SessionState.SessionStateModule" />
     <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
     <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
     <add name="PassportAuthentication" type="System.Web.Security.PassportAuthenticationModule" />
     <add name="RoleManager" type="System.Web.Security.RoleManagerModule" />
     <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />
     <add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" />
     <add name="AnonymousIdentification" type="System.Web.Security.AnonymousIdentificationModule" />
     <add name="Profile" type="System.Web.Profile.ProfileModule" />
</httpModules>

Beispiel

Das folgende Codebeispiel veranschaulicht das Hinzufügen von drei HttpModule-Verweisen zur ASP.NET-Anwendung.

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

Elementinformationen

Konfigurationsabschnittshandler

System.Web.Configuration.HttpModulesSection

Konfigurationsmember

SystemWebSectionGroup.HttpModules

Konfigurierbare Speicherorte

Machine.config

Web.config auf der Stammebene

Web.config auf der Anwendungsebene

Web.config auf der Ebene virtueller oder physikalischer Verzeichnisse

Anforderungen

Microsoft Internetinformationsdienste (IIS), Version 5.0, 5.1 oder 6.0

.NET Framework, Version 1.0, 1.1 oder 2.0

Microsoft Visual Studio 2003 oder Visual Studio 2005

Siehe auch

Aufgaben

Gewusst wie: Sperren von ASP.NET-Konfigurationseinstellungen

Referenz

system.web-Element (ASP.NET-Einstellungsschema)

<configuration>-Element

add-Element für httpModules (ASP.NET-Einstellungsschema)

clear-Element für httpModules (ASP.NET-Einstellungsschema)

remove-Element für httpModules (ASP.NET-Einstellungsschema)

System.Configuration

System.Web.Configuration

Konzepte

Übersicht über die ASP.NET-Konfiguration

ASP.NET-Webserversteuerelemente und Browserfunktionen

Absichern der ASP.NET-Konfiguration

ASP.NET-Konfigurationsszenarios

Weitere Ressourcen

ASP.NET-Konfigurationsdateien

ASP.NET-Konfigurationseinstellungen

Allgemeine Konfigurationseinstellungen (ASP.NET)

ASP.NET-Konfigurations-API