MimeMapElement Class [IIS 7 and higher]

Specifies a MIME type associated with a file extension.

Syntax

class MimeMapElement : CollectionElement

Methods

This class contains no methods.

Properties

The following table lists the properties exposed by the MimeMapElement class.

Name

Description

FileExtension

A required, unique, nonempty read-only string value that contains the file extension for MimeType. The key property.

MimeType

A required nonempty read/write string value that contains the MIME type for the extension in FileExtension.

Subclasses

This class contains no subclasses.

Remarks

Instances of this class are contained in the StaticContent array property of the StaticContentSection class.

Note

IIS serves static content for only the MIME type and file extension combinations that the MimeMapElement class specifies. The MIME map tells the static file handler how to return requests of a specific type.

Example

The following example lists file extensions and their associated MIME maps in the ApplicationHost.config file at the server level.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Get the <staticContent> section in ApplicationHost.config.
Set oSection = oWebAdmin.Get( _
    "StaticContentSection.Path='MACHINE/WEBROOT/APPHOST',Location=''")

' List the MIME maps by using the StaticContent property of the StaticContentSection class.
For Each oMimeMapElement In oSection.StaticContent
    WScript.Echo "File Extension: " & oMimeMapElement.FileExtension
    WScript.Echo "Mime Type: " & oMimeMapElement.MimeType
    WScript.Echo
Next

Inheritance Hierarchy

CollectionElement

   MimeMapElement

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

CollectionElement Class [IIS 7 and higher]

StaticContentSection Class [IIS 7 and higher]