.ASHX

ASHX File

ASP.NET Generic HTTP Handler
Ask a question
QUICK ANSWER

An ASHX file is an ASP.NET generic HTTP handler - server-side code that runs on a Microsoft IIS web server and returns raw output such as an image, a PDF, or a file download. You are not meant to open it on your computer. If a website downloaded a file named something.ashx when you expected a PDF or image, rename it to the correct extension (.pdf, .jpg, .png, .zip) and open it normally.

Developer: Microsoft Category: Web Files MIME: text/html
OPENS ON Windows macOS Linux

On this page

19k+ extensions indexed
Last reviewed Sep 9, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the ASHX file format?

The .ashx extension identifies an ASP.NET Generic HTTP Handler - a server-side component developed by Microsoft. Unlike a standard ASP.NET page, an .ashx handler processes HTTP requests directly and streams a response (binary data, JSON, images, or files) without the full page-rendering overhead of a regular .aspx page.

A genuine .ashx source file is plain text. It begins with a directive line such as <%@ WebHandler Language="C#" Class="MyHandler" %>, followed by a class implementing the IHttpHandler interface. Code inside is written in C# or VB.NET; the volume is often relatively small, since handlers are purpose-built for a single task.

.ashx files may appear unexpectedly when attempting to download a file from a website. This occurs when a handler serving the file - an image, a PDF document, or another resource - does not set the correct Content-Disposition header, so the browser saves the response with an .ashx suffix instead of the intended extension.

To recover such a file, you may use a simple trick: rename it by changing .ashx to the correct extension (for example, .pdf for a PDF document, or .jpg for an image), then try to open it with any application that supports that format. The same method applies to other file types - simply change the extension to the proper one and open the file with a program that supports the given format.

Security & safety

RISK: LOW

The .ashx extension itself says nothing about safety - in a URL it's just an endpoint of a normal website; treat the site as you would any (watch for phishing on login pages). A download that arrived as .ashx is typically the real file (PDF, image) with the wrong name and is safe to rename and open. Only be cautious with unexpected .ashx downloads from untrusted sources - inspect them as text or by their real type before opening, and never run anything they try to launch.

Format details

in a nutshell
FULL NAMEASP.NET Generic HTTP Handler
DEVELOPERMicrosoftsince 2002 (ASP.NET 1.0, .NET Framework)
CATEGORYWeb Files
MIME TYPEtext/html
TYPEServer-side ASP.NET handler source (text: directive + C#/VB.NET); also appears as a URL suffix, not a downloadable document

Programs that open ASHX files

Windows4 apps
Visual Studio Freemium For developers: open the ASP.NET project to edit/run the .ashx handler source. The standard IDE.
Notepad Open-source Open to inspect the raw handler source as text - every .ashx file is plain text.
Visual Studio Code Free Open the .ashx as text to read or edit its directive and C#/VB code. Free and cross-platform.
Web browser (Chrome, Edge, Firefox) Free Only useful if a download was misnamed - but you usually want to rename it to the real type first. A browser will NOT run the server-side handler.
macOS2 apps
TextMate Open-source Open the .ashx as a plain-text source file to inspect it.
Visual Studio Code Free Open the .ashx source as text to read or edit it.
Linux2 apps
Visual Studio Code Free Open the .ashx source as text for reading or editing.
gedit / any text editor Open-source Open directly - the handler source is plain text.

Technical details

deep spec
DeveloperMicrosoft
PlatformASP.NET (.NET Framework; also supported in early ASP.NET Core compatibility mode)
File contentPlain text; opens with a `<%@ WebHandler %>` directive followed by a C# or VB.NET class body
Implemented interface`IHttpHandler` (synchronous) or `IHttpAsyncHandler` (asynchronous operations)
Directive syntax`<%@ WebHandler Language="C#" Class="ClassName" %>`
Supported languagesC# and VB.NET
Default MIME type`text/html`; the handler overrides this by setting `context.Response.ContentType` before writing output
URL access patternInvoked directly as a URL endpoint (e.g., `download.ashx?id=1`); not a rendered browser page
Server registrationMapped in `web.config` or IIS handler mappings; the ASP.NET runtime routes matching requests to the handler class
Binary signatureNone - plain text file with no magic bytes; source files are identifiable only by the opening directive line
Session stateDisabled by default; enabled by implementing `IRequiresSessionState` on the handler class
Common usesFile downloads, dynamic image generation, AJAX/JSON endpoints, streaming binary or text data
Modern replacementASP.NET Core middleware, Minimal APIs, and `IEndpointRouteBuilder` extensions replace `.ashx` in .NET 5 and later
Download artifact behaviorBrowsers save `.ashx` as the file suffix when a handler omits `Content-Disposition`; renaming to the real extension (`.pdf`, `.jpg`, etc.) recovers the file
Released2002 (ASP.NET 1.0, .NET Framework)
Specificationlearn.microsoft.com

ASHX conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with ASHX files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about ASHX files.

Frequently asked questions

What is an .ashx file?
It's an ASP.NET generic HTTP handler - server-side code on a Microsoft IIS web server that returns raw output (an image, PDF, download, or data) to your browser. It's not a document you open; it runs on the server.
Why did a website download an .ashx file instead of a PDF or image?
The handler generated your file but the server sent it with the .ashx name. The download is usually the real file - rename it from .ashx to the type you expected (.pdf, .jpg, .png, .zip) and open it. If that fails, right-click the link and 'Save link as'.
How do I open an .ashx file?
If it's a misnamed download, rename it to the real type (.pdf/.jpg/.xlsx). If you're a developer working on the source, open it in Visual Studio or VS Code. There is no app that 'runs' an .ashx outside a web server.
What does .ashx mean in a web address?
It means that URL points to an ASP.NET HTTP handler - typically used to serve a dynamic image, file download, or data. The server runs the handler and sends back the result.
Can I convert an .ashx to PDF?
Not with a converter. If an .ashx arrived where a PDF should have, it almost certainly IS the PDF with the wrong extension - rename it to .pdf. A genuine .ashx is server code with nothing to convert.
Is an .ashx file safe?
Generally yes - as a URL it's just a web endpoint, and as a download it's usually a misnamed real file. Open unexpected .ashx downloads as their real type, and be wary only of untrusted sources.

References

1Microsoft Learn - HTTP Handlers (IHttpHandler / .ashx)learn.microsoft.com
2Microsoft Learn - Walkthrough: creating a synchronous HTTP handlerlearn.microsoft.com

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.EXEWindows Executable (Portable Executable)
4.PARTPartial Download File
5.BINCD/DVD Disc Image (BIN/CUE)
6.DATProgram Data File (generic)
7.RPMSGRestricted Permission Message
8.MDMarkdown Document
9.TXTPlain Text File
10.NOMEDIAAndroid No-Media Marker File

Related extensions

.CRDOWNLOADChrome Partial Download File
.JNLPJava Network Launch Protocol file
.WEBARCHIVESafari Web Archive
.PARTPartial Download File
.DOWNLOADPartial / Incomplete Download File
.ASPXActive Server Page Extended (ASP.NET Web Form)

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z