Share via


IIsMimeMap (ADSI)

You can use the IIsMimeMap object to set the inherited Multipurpose Internet Mail Extensions (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

Parameters
  • 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
Windows ADSI Object Properties
Metabase Properties
MimeMap
Methods
Windows ADSI Object Methods Standard methods for ADSI 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 
%>