2025-04-27 07:49:33 -04:00

172 lines
5.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<TITLE>IIsMimeMap</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
TempString = navigator.appVersion
if (navigator.appName == "Microsoft Internet Explorer"){
// Check to see if browser is Microsoft
if (TempString.indexOf ("4.") >= 0){
// Check to see if it is IE 4
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else {
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
}
}
else if (navigator.appName == "Netscape") {
// Check to see if browser is Netscape
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
//-->
</script>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Window_OnLoad()
Dim frmContents
On Error Resume Next
If Not Parent Is Nothing Then
Set frmContents = Parent.Contents
If Not frmContents Is Nothing Then
frmContents.Window.TOCSynch_Click
End If
End If
End Sub
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="MS-IT-LOC" Content="Internet Information Services">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H2><A NAME="_k2_iismimemap"></A><SUP></SUP>IIsMimeMap</H2>
<P>You can use the <B>IIsMimeMap</B> object to set the inherited Multipurpose Internet Mail Extensions (MIME) mappings used by the Web servers.</P>
<P>The <B>IIsMimeMap</B> object is an ADSI object, but not an ADSI container object.</P>
<H6>ADsPath</H6>
<DL>
<DT>IIS://<I>MachineName</I>/MIMEMAP </DT>
<DT></DT>
</DL>
<P>where <I>MachineName </I>can be any name or "LocalHost."</P>
<H6>Syntax</H6>
<P><I>varReturn </I><B>= </B><I>object</I>.<I>Method</I></P>
<P>&nbsp;</P>
<H6>Parts</H6>
<DL>
<DT><I>varReturn</I></DT>
<DD>A variable that receives the return value from the method.<BR>
</DD>
<DT><I>object</I></DT>
<DD>A variable that contains the <B>IIsMimeMap</B> object, usually as a result of a previous <B>GetObject</B> operation.<BR>
</DD>
<DT><I>Method</I></DT>
<DD>The object method chosen.</DD>
</DL>
<H6>Properties</H6>
<TABLE border=0 cellpadding=5 cols=2 frame=box rules=cols>
<TR VALIGN="top">
<TD width=50%><A HREF="/iishelp/iis/htm/asp/adsi57hv.htm">ADSI Object Properties</A></TD>
<TD width=50%>&nbsp;</TD>
</TR>
</TABLE><BR>
<H6>Metabase Properties</H6>
<TABLE border=0 cellpadding=5 cols=2 frame=box rules=cols>
<TR VALIGN="top">
<TD width=50%><A HREF="/iishelp/iis/htm/asp/apro5gs0.htm"><B>MimeMap</B></A></TD>
<TD width=50%>&nbsp;</TD>
</TR>
</TABLE><BR>
<H6>Methods</H6>
<TABLE border=0 cellpadding=5 cols=2 frame=box rules=cols>
<TR VALIGN="top">
<TD width=50%><A HREF="/iishelp/iis/htm/asp/adsi0ewj.htm">ADSI Object Methods</A></TD>
<TD width=50%>Standard methods for ADSI objects.</TD>
</TR>
</TABLE><BR>
<H6>Code Example</H6>
<PRE><CODE>&lt;%
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 &lt;&gt; ".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 "&lt;HR&gt;&lt;TABLE BORDER&gt;&lt;CAPTION&gt;&lt;B&gt;MIME Maps&lt;/B&gt;&lt;/CAPTION&gt;"
Response.Write "&lt;TR&gt;&lt;TH&gt;Type&lt;/TH&gt;&lt;TH&gt;Extension&lt;/TH&gt;"
'Display the mappings in the table.
For Each MM in aMM
Response.Write "&lt;TR&gt;&lt;TD&gt;" &amp; MM.MimeType &amp; "&lt;/TD&gt;"
Response.Write "&lt;TD&gt;" &amp; MM.Extension &amp; "&lt;/TD&gt;&lt;/TR&gt;"
Next
Response.Write "&lt;/TABLE&gt;"
End Sub
%&gt;
</CODE></PRE>
<hr class="iis" size="1">
<p align="center"><em><a href="../../../common/colegal.htm">&copy; 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
</BODY>
</HTML>