Custom MIME Types

The central web servers will only serve up files of known types. If you have a non-standard file type, the servers will always give a 404 Not Found error even though the file exists. This is a security feature that prevents scripting files with code from being served as text content (they might contain passwords or other non-public information).

However at times there is a legitimate need for a new file type to be recognized. For obscure file types which have a small user base, the file type is generally not added to the globally recognized list. Instead, the developer will need to stream out the file. Below is an example of how to create an ASP.Net page that streams out a file with a specified MIME type:

  1. Create a file named "transmitfile.aspx" in the same folder as the file to be downloaded.
  2. Copy the following content into the new file:

    <%@ Page Language="C#" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
            string FilePath = MapPath("myfile.customtype");
            Response.ContentType = "application/octet-stream";

  3. Update the myfile.customtype to the name of the file you wish to download.
  4. Update the application/octet-stream to be the content type of your file.
  5. Access your file by opening "transmitfile.aspx" at your web address.