What are .ashx files in an ASP.NET application?

Sree picture Sree · Apr 22, 2011 · Viewed 26.2k times · Source

When do you use ashx files in asp.net web application ? Can some one explain in simple terminology with a pratical example ? I understood from the msdn that .ashx files implements ihttphandler but i could not get much explanation from here http://msdn.microsoft.com/en-us/library/system.web.ihttphandler.aspx, Can some one explain it clearly for me?

Answer

Larry picture Larry · Apr 22, 2011

In short, a file ASHX is an ASPX file, minus all plumbing ASP.NET webform.

I am using ASHX to generate PDF files on the fly, and download them. Similarly, I use them to generate thumbnails on the fly and download them.

This could work very well with a blank ASPX, but ASHX files are much less resource-consuming.

Take a look at this tutorial to see how the files ashx.