Sravan Kumar
Sravan Kumar

Reputation: 1457

Difference between ASP.net Handler and Generic Handler

When we add a new item to an ASP.NET web application project in Visual Studio 2010, I have noticed two templates:

  1. ASP.NET Handler
  2. Generic Handler

What is the difference between these two and when are they used?

Upvotes: 16

Views: 12432

Answers (2)

coder
coder

Reputation: 2000

Generic handler:

Generic Handler is a default handler which will have @webhandler directive and has .ashx extension this generic handler is not having UI but it provides response when ever any request made to this handler.

HTTP Handler:

HTTP Handler is a process which runs and continue to server request and give response based on the request handling code. This handler does not have UI and need to configured in the web.config against extensions. One of the great example of Http Handler is page handler of ASP.NET which serves .aspx pages request.

The Main difference between Generic and HTTP handler is

Generic handler has a handler which can be accessed by url with .ashx extension while http handler is required to be configured in web.config against extension in web.config.It does not have any extension.Typical example of generic handler are creating thumbnails of images and for http handler page handler which serves .aspx extension request and give response.

To know more refer this link

Upvotes: 20

Ryan Byrne
Ryan Byrne

Reputation: 860

  • ASP.Net Handler is the default HTTP handler for all ASP.Net pages.
  • Generic Handler is the default HTTP handler for all Web handlers that do not have a UI and that include the @ WebHandler directive.

For more information see MSDN.

Upvotes: 6

Related Questions