What are HttpHandlers and HttpModules in asp.net

I always wondered what happens when a page is requested to the web server and what is the role of Http Handlers and HttpModules.So in this article I have given a small description about HttpHandlers and HttpModules and also when we can create custom handlers and modules.

Http Handler : An asp.net Http handler is the process that runs in response to a request made to an asp.net application.
The most common handler is the PageHandler that process the .aspx files.
We can also create our own custom handler that renders custom output to the browser.
For e.g., custom handler can be used for RSS feeds, Image server, etc

HttpModules : It allows to examine the incoming and outgoing requests and takes action based on the request.
HttpModules can be used for following purposes

1) Security : Since the incoming request is examined a HttpModule
can perform a custom authentication check or any other security checks before the requested page is called

2)Statistics and Logging : Because HttpModules are called on every request, we can gather request statitics and log
information in a centralized module instead of an individual page

3) Custom headers or footers : Since the outgoing response can be modified ,we can insert content such as custom
header information into every page or Xml webservice response

IHttpHandler and IHttpModule interface are starting point for developing handlers and modules


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: