What are the benefits of using an ashx, or handler? Also, do I need them if I use MVC (and why not)?
Does the framework matter (2.0+)?
Why would I want to use a handler? I was recently recommended to use one for retrieving an image but I don't know why.
Thank you for your time.
Edit - is a handler faster?
ASHX files are files used with ASP.NET programming and can be opened with any program that codes in ASP.NET, such as Microsoft Visual Studio and Microsoft Visual Community. As they are text files, you can also open ASHX files with a text editor program.
An ASP.NET HTTP handler is the process that runs in response to a request that is 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 handler.
A "handler" is an internal Apache representation of the action to be performed when a file is called. Generally, files have implicit handlers, based on the file type. Normally, all files are simply served by the server, but certain file types are "handled" separately.
Just a few examples:
Dynamic image generation: You can write handlers that return data driven images by creating an ASHX handler that returns image data and then using that URL in your tags. e.g. <img alt="user's custom icon" src="Icon.ashx?username=bob"></img>
Returning REST-based XML or JSON data to AJAX code on the client.
I believe this has been available since 1.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With