I sometimes see ASP.NET apps that include ASHX files. What are ASHX files?
Amit Das
.ashx files are web-handler files in asp.net programming and define IHttpHandler interface. Whenever an .ashx file is requested, ProcessRequest() method is invoked automatically. ProcessRequest() is a method where we do make changes according to our requirement. Handlers are used in URL routing, Image handling, binary data handling etc. as it support backward compatibility.
ASHX files contain HTTP handlers-software modules that handle raw HTTP requests received by ASP.NET. The following code institutes a simple HTTP handler:
<%@ WebHandler Language="C#" Class="Hello"%>using System.Web;public class Hello : IHttpHandler{ public void ProcessRequest (HttpContext context) { string name = context.Request["Name"]; context.Response.Write ("Hello, " name); } public bool IsReusable { get { return true; } }}