What Is an ASHX File?

Here's how to open one, plus why your PDF is incorrectly renamed as an ASHX file

What to Know

  • An ASHX file is an ASP.NET Web Handler file.
  • Open one with Microsoft Visual Studio or a text editor.
  • Rename the file to filename.pdf if it should really be a PDF document.

This article explains what an ASHX file is and how it's used, plus how to open it on your computer or convert it to a different file format.

What Is an ASHX File?

A file with the ASHX file extension is an ASP.NET Web Handler file that often holds references to other web pages used in an ASP.NET web server application.

The functions in the file are written in the C# programming language, and sometimes the references are so short that the file may end up just being a single line of code.

Most people encounter this format only by accident when they try to download a file from a website, like a PDF file. This is because the ASHX file references the PDF file to send it to the browser for download but doesn't name it correctly, attaching .ASHX at the end instead of .PDF.

ASHX Files

How to Open an ASHX File

ASHX files are files used with ASP.NET programming and can be opened with any program that codes in ASP.NET, like Microsoft Visual Studio and Microsoft Visual Studio Community.

Since they're text files, you can also open ASHX files with a text editor program like Notepad++. Use this Best Free Text Editors list to see our favorites.

ASHX files aren't intended to be viewed or opened by a web browser. If you've downloaded one and expected it to contain information (like a document or other saved data), it's likely that something is wrong with the website and instead of generating usable information, it provided this server-side file instead.

You technically can view the text of an ASHX file using some web browsers, but that doesn't mean the file is supposed to be opened in that way. In other words, a true ASHX file, which contains readable text for ASP.NET applications, can be viewed in your browser, but not all .ASHX files are actually ASP.NET Web Handler files. There's more on this point, below.

The best trick with an ASHX file is to simply rename it to the kind of file you expected it to be. It seems many are really supposed to be PDF files so, for example, if you download an ASHX file from your electric company or bank, just rename it as statement.pdf and open it with a PDF reader. Apply the same logic for a music file (rename it to file.mp3), image file (.png or .jpg), etc.

When these problems occur, the website you're visiting that's running the ASHX file is having some kind of issue, and this last step, where the ASP.NET HTTP Handler which processes the ASHX file on the server, isn't naming it to whatever.whatever. So renaming the file is just you doing the last step yourself.

If this is happening a lot when you download PDF files specifically, there might be a problem with the PDF plug-in that your browser is using. You should be able to fix this glitch by switching the browser to use the Adobe PDF plug-in instead.

You can't just rename any file to have a different extension and expect it to work properly because changing the file extension doesn't actually change the file format. For example, you can't rename a .PDF file to a .DOCX file and assume it will open just fine in a word processor. A conversion tool is necessary for true file conversions.

How to Convert an ASHX File

You don't need to convert an ASHX file to any other format, unless it's one of the file formats listed in the "Save As" dialog box in Visual Studio or one of the other programs mentioned above.

The formats listed there are other text-based formats, since that's what a true ASHX file is—a text file.

Actually, should the file ever be changed to use a different file extension, it most likely will immediately stop working within the ASP.NET web server since other files that reference it, won't know where the file is.

Still Can't Open It?

If you can't open your file, double-check that you're actually using an ASHX file. Some files use a file extension that looks like this, but function entirely differently.

For example, an ASHX file is not the same as an ASH file, which might be a Nintendo Wii System Menu file, Audiosurf Audio Metadata file, or KoLmafia ASH Script file. In each of those cases, a different program is required to open the file.

The same is true if you have an ASX, ASCX, ASHBAK, or AHX file. These are either Microsoft ASF Redirector files or Alpha Five Library Temporary Index files; ASP.NET Web User Control files; Ashampoo Backup Archive files; or WinAHX Tracker Module files or AutoHotkey Script files.

The idea in all of these cases is simple: research the file extension to see which program is able to open it, or what service/application is capable of converting it to a different format.

  • How do I open an ASHX file on a Mac?

    To open an ASHX file on a Mac, try Apple's TextEdit, AbiSource, AbiWord, or MacroMates TextMate. You can also open an ASHX file in a web browser on your Mac.

  • How do I convert an ASHX file to a PDF?

    An easy way to convert an ASHX file to PDF is to open the file in a web browser. Your PDF reader will open; from there, save the file as PDF to your local drive. Another option to try: rename the file as a .pdf, then open it in Adobe Reader.

  • How do I create an ASHX file in ASP.NET?

    To create a generic handler (ASHX file), press Control+N. Then, under Web > C#, select the Generic Handler template. 

Was this page helpful?