What Is an ASAX File?

ASAX files are ASP.NET server application files

What to Know

  • Open an ASP.NET server application file with Visual Studio.
  • Some ASAX files are generated by mistake. Change the file extension to PDF if you know it should be a document.

This article describes what an ASAX file is and how to open one in Windows.

What Is an ASAX File?

A file with the ASAX file extension is an ASP.NET server application file.

The most common ASAX file is global.asax (also called ASP.NET Application File) that's used for handling certain functions like when the application starts up or shuts down. A web application can only have one of these ASAX files, and it's completely optional to include with the application.

Below the following section is some additional information on ASAX files.

ASAX files in Windows 10

How to Open an ASAX File

Microsoft's Visual Studio software can open ASAX files.

Since these are just text files that contain code, you can use any text editor to open them. Windows has the Notepad application built-in to the OS that can open the file, but so can third-party text editors like the free Notepad++.

ASAX files aren't intended to be viewed or opened by a web browser. If you've downloaded an ASAX file 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 file instead.

If this happens, you should be able to rename the file extension from .ASAX to the extension that the file should have been saved with. For example, say you're trying to download a bank statement in the PDF format, but you get an ASAX file instead; just rename the file from .ASAX to .PDF so that you can open it in a PDF reader as intended.

You can't normally change a file's extension like this and expect the new file to work normally. For that, you'd need a file converter tool. However, in this instance, the problem lies solely in the fact that the file extension was inappropriately named, so renaming it to the right extension will work just fine.

More Information on the Global.asax File

The global.asax file resides in the root directory of the ASP.NET application and can't be downloaded or viewed by any request except ones that originate on the server side. This means that any external attempt to view or download this particular ASAX file is blocked by default.

You can read more about what the global.asax file is used for at DotNetCurry.com. That website explains how to use the global.asax file and gives a sample file so you can see how the information in the file is structured. Another good source on the purpose of the global.asax file is this Stack Overflow thread.

How to Convert an ASAX File

An ASAX file that needs to remain functional as an ASP.NET file shouldn't be converted to any other format. Doing so would mean that the application can't find the file and so can't use it like it needs to.

If you're looking for how to convert global.asax to Code-Behind in order to put the source code in a separate file, see this thread at Coding Forums.

Still Can't Open the File?

The programs mentioned above should have no problem opening ASAX files. If they aren't working, it's likely that you're not really using an ASAX file, which can happen if you've misread the file extension.

For example, ASX and ASA files aren't the same as ASAX files. Even though their file extensions are very similar, an ASX file is a Microsoft ASF Redirector file that stores a playlist of audio or video files, like ASF files. You can open an ASX file with VLC or Windows Media Player. ASA files are ASP Configuration files that a text editor can open.

The same could be said for ASCX and any other similarly spelled file extensions: just because the same or similar letters are used doesn't mean that the formats are related and that the files can be opened with the same programs.

If you don't really have an ASAX file, research the real file extension to learn more about the format it's in and which programs can open or convert it.

  • How do I add a global ASAX file?

    In Visual Studio, go to Website or Project > Add New Item > Global Application Class Template. Along with the ASAX file, Visual Studio will automatically generate application event handlers.

  • What are ASCX, ASPX, and ASHX files?

    ASCX files contain code that can be used across multiple ASP.NET web pages. An ASHX file is an ASP.NET web handler file that usually holds references to other web pages. ASPX files contain scripts and source codes that tell the browser how a web page should be displayed.

Was this page helpful?