Every file that’s transferred between IIS and a client browser has a data type designator, which is expressed as a Multipurpose Internet Mail Extensions (MIME) type. IIS fully supports MIME.
To understand MIME, you need to know how servers transfer files using HTTP. HTTP is a multipurpose protocol that you can use to transfer many types of files, including full-motion video sequences, stereo sound tracks, high-resolution images, and other types of media. The transfer of media files wouldn’t be possible without the MIME standard. Web servers use MIME to identify the type of object being transferred. Object types are identified in an HTTP header field that comes before the actual data, and this allows a Web client to handle the object file appropriately.
Web servers set the MIME type using the Content_Type directive, which is part of the HTTP header sent to client browsers. MIME types are broken down into categories, with each category having a primary subtype associated with it. Basic MIME types are summarized in Table 4-4.
Table 4-4. Basic MIME Types
Type | Description |
---|---|
Application | Binary data that can be executed or used with another application |
Audio | A sound file that requires an output device to preview |
Image | A picture that requires an output device to preview |
Message | An encapsulated mail message |
Multipart | Data consisting of multiple parts and possibly many data types |
Text | Textual data that can be represented in any character set or formatting language |
Video | A video file that requires an output device to preview |
X-world | Experimental data type for world files |
MIME subtypes are defined in three categories:
Primary. Primary type of data adopted for use as a MIME content type
Additional. Additional subtypes that have been officially adopted as MIME content types
Extended. Experimental subtypes that haven’t been officially adopted as MIME content types
You can easily identify extended subtypes because they begin with the letter x followed by a hyphen. Table 4-5 lists common MIME types and their descriptions.
Table 4-5. Common MIME Types
Type/Subtype | Description |
---|---|
Application/mac-binhex40 | Macintosh binary-formatted data |
Application/msword | Microsoft Word document |
Application/octet-stream | Binary data that can be executed or used with another application |
Application/pdf | Acrobat Portable Document Format (PDF) document |
Application/postscript | Postscript-formatted data |
Application/rtf | Rich Text Format (RTF) document |
Application/x-compress | Data that has been compressed using UNIX compress |
Application/x-gzip | Data that has been compressed using UNIX gzip |
Application/x-tar | Data that has been archived using UNIX tar |
Application/x-zip-compressed | Data that has been compressed using PKZip or WinZip |
Audio/basic | Audio in a nondescript format |
Audio/x-aiff | Audio in Apple Audio Interchange File Format (AIFF) |
Audio/x-wav | Audio in Microsoft WAV format |
Image/gif | Image in Graphics Interchange Format (GIF) |
Image/jpeg | Image in Joint Photographic Experts Group (JPEG) format |
Image/tiff | Image in Tagged Image File Format (TIFF) |
Text/html | HTML-formatted text |
Text/plain | Plain text with no HTML formatting included |
Video/mpeg | Video in the Moving Picture Experts Group (MPEG) format |
Video/quicktime | Video in the Apple QuickTime format |
Video/x-msvideo | Video in the Microsoft Audio Video Interleaved (AVI) format |
X-world/x-vrml | Virtual Reality Modeling Language (VRML) world file |
Hundreds of MIME types are configured using file extension to file type mappings. These mappings allow IIS to support just about any type of file that applications or utilities on the destination computer might expect. If a file doesn’t end with a known extension, the file is sent as the default MIME type, which indicates that the file contains application data. In most cases use of the default MIME type means that the client is unable to handle the file or to trigger other utilities that handle the file. If you expect the client to handle a new file type appropriately, you’ll need to create a file extension to file type mapping.
MIME type mappings set in Web Sites Properties apply to all Web sites on the server. In the Properties dialog box for a specific site, you can edit existing MIME types, configure additional MIME types, or delete unwanted MIME types. These changes are applied to all Web sites the next time you start IIS. You can also create additional MIME type mappings for individual sites and directories. When you do this, the MIME type mappings are available only in the site or directory in which they’re configured.
You can create new MIME types for all Web sites on a server by completing the following steps:
In the IIS snap-in, right-click the computer node for the IIS server you want to work with and then select Properties.
Click MIME Types. As shown in Figure 4-7, you should see a list of the computer MIME types. Computer MIME types are active for all Web sites on the server.
Use the following options to configure new computer MIME types:
New. Adds a new MIME type. Type a file extension in the Extension field, such as .html, and then type a MIME type in the MIME Type field, such as text/html. Complete the process by clicking OK.
Remove. Removes a MIME type mapping. To remove a MIME type, select it and then click Remove.
Edit. Edits a MIME type mapping. To edit a MIME type, select it and then click Edit. Use the MIME Type dialog box provided to change the file extension and the content MIME type.
Click OK twice.
You can limit the availability of custom MIME types by adding MIME types at the site or directory level. When you work with MIME settings at this level, the only values displayed are those you’ve defined.
To view or configure site or directory MIME settings, follow these steps:
In the IIS snap-in, right-click the Web site you want to manage and then choose Properties.
On the HTTP Headers tab, click MIME Types. This displays the MIME Types dialog box.
Use the following options to register new MIME types:
New. Adds a new MIME type. Type a file extension in the Extension field, such as .html, and then type a MIME type in the MIME Type field, such as text/html. Complete the process by clicking OK.
Remove. Removes a MIME type mapping. To remove a MIME type, select it and then click Remove.
Edit. Edits a MIME type mapping. To edit a MIME type, select it and then click Edit. Use the MIME Type dialog box provided to change the file extension and the content MIME type.
Click OK twice.