次の方法で共有


IIsMimeType.Extension (ADSI)

The Extension method gets or sets a string indicating the file name extension, for example, ".xml". Also use MimeType to set the MIME type that is mapped to this file name extension.

objIIsMimeType.Extension = <file name extension>

Code Example

<% 
Dim MimeMapObj 
Dim MimeMapList 
Const ADS_PROPERTY_UPDATE = 2 
Dim NewMimeMapSize 

' Use GetEx to retrieve the MimeMap Array 
Set MimeMapObj = GetObject("IIS://localhost/MimeMap") 
MimeMapList = MimeMapObj.GetEx("MimeMap") 

' Create a new item in the array 
NewMimeMapSize = UBound(MimeMapList) + 1  
Redim preserve MimeMapList (NewMimeMapSize) 

' Create our new MimeType item 
Set MimeMapList(NewMimeMapSize) = CreateObject("MimeMap")  
MimeMapList(NewMimeMapSize).Extension = ".log"  
MimeMapList(NewMimeMapSize).MimeType = "text/plain"  

' Use PutEx to UPDATE the MimeMap array with our new array 
MimeMapObj.PutEx ADS_PROPERTY_UPDATE, "MimeMap", MimeMapList 
MimeMapObj.SetInfo  
%> 

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

See Also

Concepts

IISMimeType

IIsMimeType (ADSI)

IIsMimeMap (ADSI)

Using ADSI to Configure IIS