IIsMimeMap

You can use the IIsMimeMap object to set the inherited Multipurpose Internet Mail Extension (MIME) mappings used by the Web servers.

The IIsMimeMap object is an ADSI object, but not an ADSI container object.

ADsPath

IIS://MachineName/MimeMap

Where MachineName can be any name or "LocalHost".

Syntax

varReturn = object.{Method}
 

Parts

varReturn
A variable that receives the return value from the method.
object
A variable that contains the IIsMimeMap object, usually as a result of a previous GetObject operation.
Method
The object method chosen.

Properties

ADSI Object Properties

Metabase Properties

MimeMap

Methods

ADSI Object Methods Standard methods for ADSI objects
Common Object Methods Methods, other than ADSI methods, common to all IIS Admin Objects

Code Example

<% 
Dim MimeMapObj, aMimeMap, MMType, MMExtension, i, aMimeMapNew() 
Const ADS_PROPERTY_UPDATE = 2 
' Get the mimemap object 
Set MimeMapObj = GetObject("IIS://LocalHost/MimeMap") 
' Get the mappings from the MimeMap property 
aMimeMap = MimeMapObj.GetEx("MimeMap") 
' Display the mappings 
ShowMM(MimeMapObj) 
' Add a new mapping 
i = UBound(aMimeMap) + 1 
Redim Preserve aMimeMap(i) 
Set aMimeMap(i) = CreateObject("MimeMap") 
aMimeMap(i).Extension = ".jnq" 
aMimeMap(i).MimeType = "junque/my-junque" 
MimeMapObj.PutEx ADS_PROPERTY_UPDATE, "MimeMap", aMimeMap 
MimeMapObj.SetInfo 
' Display the mappings 
ShowMM(MimeMapObj) 
' Delete a mapping by copying to a new map array 
i = 0 
For Each MMItem in aMimeMap 
    If MMItem.Extension <> ".jnq" Then 
        Redim Preserve aMimeMapNew(i) 
        Set aMimeMapNew(i) = CreateObject("MimeMap") 
        aMimeMapNew(i).Extension = MMItem.Extension 
        aMimeMapNew(i).MimeType = MMItem.MimeType 
        i = i + 1 
    End If 
Next 
MimeMapObj.PutEx ADS_PROPERTY_UPDATE, "MimeMap", aMimeMapNew 
MimeMapObj.SetInfo 
' Display the mappings 
ShowMM(MimeMapObj) 
' Subroutine to display the mappings in a table 
Sub ShowMM(MMObj) 
aMM = MMObj.GetEx("MimeMap") 
' Set up table to display mappings 
Response.Write "<HR><TABLE BORDER><CAPTION><B>MIME Maps</B></CAPTION>" 
Response.Write "<TR><TH>Type</TH><TH>Extension</TH>" 
' Display the mappings in the table 
For Each MM in aMM 
    Response.Write "<TR><TD>" & MM.MimeType & "</TD>" 
    Response.Write "<TD>" & MM.Extension & "</TD></TR>" 
Next 
Response.Write "</TABLE>" 
End Sub 
%>