MimeMapElement Class

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 - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF file WebAdministration.mof

See Also

CollectionElement Class
StaticContentSection Class