in Education by
What are the differences between ASP.NET HttpHandler and HttpModule?

1 Answer

0 votes
by

The user requests for a resource on web server. The web server examines the file name extension of the requested file, and determines which ISAPI extension should handle the request. Then the request is passed to the appropriate ISAPI extension. For example when an .aspx page is requested it is passed to ASP.NET page handler. Then Application domain is created and after that different ASP.NET objects like Httpcontext, HttpRequest, HttpResponse are created. Then instance of HttpApplication is created and also instance of any configured modules. One can register different events of HttpApplication class like BeginRequest, AuthenticateRequest, AuthorizeRequest, ProcessRequest etc.

HTTP Handler

HTTP Handler is the process which runs in response to a HTTP request. So whenever user requests a file it is processed by the handler based on the extension. So, custom http handlers are created when you need to special handling based on the file name extension. Let's consider an example to create RSS for a site. So, create a handler that generates RSS-formatted XML. Now bind the .rss extension to the custom handler.

HTTP Modules

HTTP Modules are plugged into the life cycle of a request. So when a request is processed it is passed through all the modules in the pipeline of the request. So generally http modules are used for,

  • Security: For authenticating a request before the request is handled.
  • Statistics and Logging: Since modules are called for every request they can be used for gathering statistics and for logging information.
  • Custom header: Since response can be modified, one can add custom header information to the response.

Related questions

0 votes
    What is the difference between HttpContext.Current.Items and HttpContext.Current.Session in ASP.NET?...
asked Apr 7, 2021 in Education by JackTerrance
0 votes
    What are the Navigations techniques in ASP.NET?...
asked Apr 8, 2021 in Education by JackTerrance
0 votes
    What are different methods of session maintenance in ASP.NET?...
asked Apr 7, 2021 in Education by JackTerrance
0 votes
    What are the authentication modes in ASP.NET for security?...
asked Apr 7, 2021 in Education by JackTerrance
0 votes
    What are the HTML server controls in ASP.NET?...
asked Apr 7, 2021 in Education by JackTerrance
0 votes
    What are the data controls available in ASP.NET?...
asked Apr 6, 2021 in Education by JackTerrance
0 votes
0 votes
    What are the different Session state management options available in ASP.NET?...
asked Apr 6, 2021 in Education by JackTerrance
0 votes
    What are the different validators in ASP.NET?...
asked Apr 6, 2021 in Education by JackTerrance
0 votes
    What is Data Cache in ASP.NET and how to use?...
asked Apr 8, 2021 in Education by JackTerrance
0 votes
    What is authentication and authorization in ASP.NET?...
asked Apr 7, 2021 in Education by JackTerrance
0 votes
    How can we improve the Performance of an ASP.NET Web Page?...
asked Apr 8, 2021 in Education by JackTerrance
0 votes
    What is Enterprise Library in ASP.NET?...
asked Apr 8, 2021 in Education by JackTerrance
0 votes
0 votes
    What is Themes in ASP.NET?...
asked Apr 8, 2021 in Education by JackTerrance
...