An ASHX file is a webpage that is used by the ASP.NET HTTP Handler to serve user with the pages that are referenced inside this file. The ASP.NET HTTP Handler processes the incoming request, references the pages from the .ashx file, and sends back the compiled page back to the user’s browser. The method of processing is mostly similar to that of ASPX files with the differecne that in this case, the referenced pages/documents are processed and sent back.
ASHX File Format
The .ashx files are saved in plain text file format and contains references to other pages or documents that are sent back to user’s browser upon request. These can be opened in any text editor and developer IDEs such as Xamarin Studio, Microsoft Notepad, Notepad++, and many more. The ASHX files are useful in case when you have:
Dynamic image views
Performance-critical web pages
Minimal web pages
How to dynamically compile an ASHX file?
The following steps can be used to add and compile an ASHX file using Microsoft Visual Studio.
add a Generic handler - Handler1.ashx in visual studio