HttpModules and HttpHandlers in ASP.NET

facebooktwittergoogle_plusredditpinterestlinkedinmail

HttpModules
An HTTP module is an assembly that is called on every request made to your application. HTTP modules are called as part of the ASP.NET request pipeline and have access to life cycle events throughout the request.

HttpHandlers

An ASP.NET HTTP handler is the process (frequently referred to as the “endpoint”) that runs in response to a request made to an ASP.NET Web application. The most common handler is an ASP.NET page handler that processes .aspx files. When users request an .aspx file, the request is processed by the page through the page handler. You can create your own HTTP handlers that render custom output to the browser.

Comparison between HttpModules and HttpHandlers in ASP.NET

HttpModules HttpHandlers
Many HttpModules can service one request Only one HttpHandler can service a request
Modify and support request through services Generate the response that is sent back to the browser
Implemented through the IHttpHandler interface Implemented through the IHttpHandler interface
Registered through code or the web.config file Registered through code or the web.config file
Designed to integrate with any of the Life Cycle Events Generally only concerned with the events related to handler mapping and execution

See Also

Custom httphandler in ASP.NET MVC

The following two tabs change content below.

Tom Mohan

Tom Mohan is a technologist who loves to code and build. He enjoys working on Microsoft Technologies. Tom specializes in ASP.NET MVC, Web API , Azure, C# ,WPF, SQL etc and holds a Bachelor engineering degree in Computer Science. Certification : MCSD , MCTS