INFO: ASP.NET HTTP Modules and HTTP Handlers Overview
This article was previously published under Q307985 On This PageSUMMARY This article provides an introduction to the ASP.NET HTTP
modules and HTTP handlers. For additional ASP.NET overviews, refer to the following Microsoft Knowledge Base article: 305140 (http://support.microsoft.com/kb/305140/EN-US/) INFO: ASP.NET Roadmap
MORE INFORMATION HTTP modules and HTTP handlers are an integral part of the
ASP.NET architecture. While a request is being processed, each request is
processed by multiple HTTP modules (for example, the authentication module and
the session module) and is then processed by a single HTTP handler. After the
handler has processed the request, the request flows back through the HTTP
modules. This article is divided into the following sections:
HTTP ModulesModules are called before and after the handler executes. Modules enable developers to intercept, participate in, or modify each individual request. Modules implement the IHttpModule interface, which is located in the System.Web namespace.Available EventsAn HttpApplication class provides a number of events with which modules can synchronize. The following events are available for modules to synchronize with on each request. These events are listed in sequential order:
Configuring HTTP ModulesThe <httpModules> configuration section handler is responsible for configuring the HTTP modules within an application. It can be declared at the computer, site, or application level. Use the following syntax for the <httpModules> section handler:Creating HTTP ModulesTo create an HTTP module, you must implement the IHttpModule interface. The IHttpModule interface has two methods with the following signatures:For additional information about creating HTTP modules, click
the article numbers below to view the articles in the Microsoft Knowledge Base:
308000 (http://support.microsoft.com/kb/308000/EN-US/) HOW TO: Create an ASP.NET HTTP Module by Using Visual Basic .NET
307996 (http://support.microsoft.com/kb/307996/EN-US/) HOW TO: Create an ASP.NET HTTP Module by Using Visual C# .NET
HTTP HandlersHandlers are used to process individual endpoint requests. Handlers enable the ASP.NET framework to process individual HTTP URLs or groups of URL extensions within an application. Unlike modules, only one handler is used to process a request. All handlers implement the IHttpHandler interface, which is located in the System.Web namespace. Handlers are somewhat analogous to Internet Server Application Programming Interface (ISAPI) extensions.Configuring HTTP HandlersThe <httpHandlers> configuration section handler is responsible for mapping incoming URLs to the IHttpHandler or IHttpHandlerFactory class. It can be declared at the computer, site, or application level. Subdirectories inherit these settings.Administrators use the <add> tag directive to configure the <httpHandlers> section. <Add> directives are interpreted and processed in a top-down sequential order. Use the following syntax for the <httpHandler> section handler: Creating HTTP HandlersTo create an HTTP handler, you must implement the IHttpHandler interface. The IHttpHandler interface has one method and one property with the following signatures:NOTE: If session state is required in your HTTP handler, you also need
to implement the IRequiresSessionState interface.
For additional information about creating HTTP handlers, click
the article numbers below to view the articles in the Microsoft Knowledge Base:
308001 (http://support.microsoft.com/kb/308001/EN-US/) HOW TO: Create an ASP.NET HTTP Handler by Using Visual C# .NET
For additional information, click
the article numbers below to view the articles in the Microsoft Knowledge Base:
307997 (http://support.microsoft.com/kb/307997/EN-US/) HOW TO: Create an ASP.NET HTTP Handler by Using Visual Basic .NET
| Article Translations
|

Back to the top
