Defining a new MIME type
Despite all the help IIS provides, you may eventually need to add a MIME type to the list. Make sure to use a valid MIME type for the file extension or else users of your Web site will experience problems. Use these steps to add a new MIME type:
- Select the connection you want to use in the Connections pane.
- Double-click the MIME Types icon.
- Click Add.
You see the Add Mime Type dialog box. - Type the file extension you want to use, complete with initial period, in the File Name Extension field.
- Type the registered MIME type in the MIME Type field.
Make sure to include the file type (or category, depending on which resource you use), followed by a slash, followed by the file handler type. For example, application/wav is valid, but wav alone is not. MIME types don't typically include any spaces - application /wav isn't valid either. - Click OK.
IIS adds the new MIME type to the list in alphabetical order by file extension.
Associating a MIME type with an application
Setting the MIME type in IIS doesn't ensure that there's a program to handle the file type. The registry contains a number of file extensions that lack a corresponding application. Consequently, when an application sees the file extension, it won't know what to do with the file even though it has an associated MIME type. Theoretically, Windows asks the user to look for an application to handle the file either locally or online. However, you can also help the user to set the correct handler. Use these steps to associate an application with a file type in Vista and Windows Server 2008:
- Open the Default Programs applet of the Control Panel.
You see the Default Programs window, which contains options for setting the default programs on your system. - Click Associate File Type or Protocol with a Program.
You see a list of file extensions. - Highlight the file extension you want to change.
- Click Change Program.
You see an Open With dialog box. If you try to change a system file extension, such as .386, Windows Server 2008 warns you that the file is an executable and encourages you not to associate an application with it. If you still want to associate an application with the file extension, click Open With and you see the normal Open With dialog box. - Choose the application you want to associate with the file and then click OK.
Windows creates the file association and uses the application to handle files of that MIME type.
Associating a MIME type with an application
Setting the MIME type in IIS doesn't ensure that there's a program to handle the file type. The registry contains a number of file extensions that lack a corresponding application. Consequently, when an application sees the file extension, it won't know what to do with the file even though it has an associated MIME type. Theoretically, Windows asks the user to look for an application to handle the file either locally or online. However, you can also help the user to set the correct handler. Use these steps to associate an application with a file type in Vista and Windows Server 2008:
- Open the Default Programs applet of the Control Panel.
You see the Default Programs window, which contains options for setting the default programs on your system. - Click Associate File Type or Protocol with a Program.
You see a list of file extensions. - Highlight the file extension you want to change.
- Click Change Program.
You see an Open With dialog box. If you try to change a system file extension, such as .386, Windows Server 2008 warns you that the file is an executable and encourages you not to associate an application with it. If you still want to associate an application with the file extension, click Open With and you see the normal Open With dialog box. - Choose the application you want to associate with the file and then click OK.
Windows creates the file association and uses the application to handle files of that MIME type.
Editing and deleting MIME types
You may run into a situation where you have to modify a MIME type. In very rare cases, you might have to edit one to correct it for mistakes. The MIME types that you obtain with IIS should be correct, as are those from IANA. However, you might obtain a bad MIME type from the registry (rare, but it could happen during an application installation), the vendor, or a third-party Web site. The steps for editing a MIME type are similar to those used to add one. The only difference is that you click Edit rather than Add. See the "Defining a new MIME type" section of this tutorial for details.
You may decide that you don't want the server to support a particular MIME type. For example, the MIME type may not exist on your server and shouldn't exist under normal circumstances. Removing the MIME type could alert you to problems with content that others are placing on the Web site or to the changes an outsider is making to your files. Normally, you don't want to remove standard MIME entries that someone could legitimately use to ensure that the output from the Web site is correct. When you want to remove a MIME type, highlight the entry and click Remove.