Article ID: 248364 - Last Review: June 30, 2004 - Revision: 4.0

Updating Mime Types with ADSUTIL.vbs Results in Corrupted Mime Type Metabase Entries

This article was previously published under Q248364
Expand all | Collapse all

SYMPTOMS

When you are creating or updating Mime Types with the Visual Basic Script ADSUTIL.vbs that ships with Microsoft Internet Information Server (IIS) 4.0 and above, the script can lead to a corrupted Mime Type Metabase entry.

CAUSE

There is an error in function MimeMapSet of the ADSUTIL.vbs script:
Function MimeMapSet(ObjectPath, ObjectParameter, MachineName)
       .
       .   (some lines removed)
       .

        ' Fill the list with mime entries
        For MimeEntryIndex = 0 To UBound(MimeMapList)

                MimeStr = Args(2 + MimeEntryIndex)
                MimeOutPutStr = MimeOutPutStr & """" & MimeStr & """ "

                Set MimeEntry = CreateObject("MimeMap")

ERROR -->       MimeEntry.MimeType = Right(MimeStr, InStr(MimeStr, ",") - 1)
                MimeEntry.Extension = Left(MimeStr, InStr(MimeStr, ",") - 1)

                Set MimeMapList(MimeEntryIndex) = MimeEntry
        Next

       .
       .   (some lines removed)
       .
End Function
				
The script line with the ERROR contains a wrong string calculation

RESOLUTION

Replace the line starting with "ERROR" in the "Cause" section with the following code:
                MimeEntry.MimeType = Right(MimeStr, len(MimeStr) - InStr (MimeStr, ","))
				
Now you can use the ADSUTIL.vbs script to update your Mime types. The following example shows how to replace the MimeMap of the Default Web Site with a new one that lists two Mime types:
cscript adsutil set w3svc/1/root/MimeMap ".hmtlx,text/html" ".htmla,text/html"
				

REFERENCES

More information on the ADSUTIL.vbs script can be found in:
240225  (http://support.microsoft.com/kb/240225/EN-US/ ) Description of Adsutil and MetaEdit Used to Modify the Metabase


APPLIES TO
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Services 5.0
Keywords: 
kbprb KB248364
 

Article Translations

 

Related Support Centers