locked
Difference between Generic Handler(.ashx) and Asp.net Handler(.cs) RRS feed

  • Question

  • User-460739707 posted

    What's the difference between Generic Handler(.ashx) and Asp.net Handler(.cs) when you create your own handler in your asp.net project?

    Monday, March 31, 2014 11:08 PM

Answers

  • User1779161005 posted

    None other than packaging -- the .ashx can be compiled on-demand like an .aspx, whereas a .cs file must be compiled into an assembly then configured in the <handlers> section in web.config.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 31, 2014 11:13 PM
  • User-1818759697 posted

    Hi,

    Here is the difference between Generic Handler(.ashx) and Asp.net Handler:

    Generic handler:

    As per MSDN 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.

    Difference between generic handler and http handler:

    Following is a main differences between http handler and generic handler.

    1. 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
    2. Typical example of generic handler are creating thumbnails of images and for http handler page handler which serves .aspx extension request and give response.

    For more information, you could refer to:

    http://msdn.microsoft.com/en-us/library/bb398986%28v=vs.100%29.aspx#Features

    http://www.codeproject.com/Articles/353260/ASP-NET-Advanced-Generic-Handler-ASHX

    Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 2, 2014 2:49 AM

All replies

  • User1779161005 posted

    None other than packaging -- the .ashx can be compiled on-demand like an .aspx, whereas a .cs file must be compiled into an assembly then configured in the <handlers> section in web.config.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 31, 2014 11:13 PM
  • User-1818759697 posted

    Hi,

    Here is the difference between Generic Handler(.ashx) and Asp.net Handler:

    Generic handler:

    As per MSDN 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.

    Difference between generic handler and http handler:

    Following is a main differences between http handler and generic handler.

    1. 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
    2. Typical example of generic handler are creating thumbnails of images and for http handler page handler which serves .aspx extension request and give response.

    For more information, you could refer to:

    http://msdn.microsoft.com/en-us/library/bb398986%28v=vs.100%29.aspx#Features

    http://www.codeproject.com/Articles/353260/ASP-NET-Advanced-Generic-Handler-ASHX

    Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 2, 2014 2:49 AM