A
Anthony Jones
Hi people,
I use the following code to read the server's mimemap and resove a file
extension to a mime type:-
Public Function GetMimeType(ByVal Extension)
Dim oMimeMap
Dim vntMimeType
Dim avntMap()
Set oMimeMap = GetObject("IIS://LocalHost/MimeMap")
If Left(Extension, 1) <> "." Then Extension = "." & Extension
avntMap() = oMimeMap.MimeMap
For Each vntMimeType In avntMap
If vntMimeType.Extension = Extension Then
GetMimeType = vntMimeType.MimeType
Exit For
End If
Next
If GetMimeType = "" Then GetMimeType = "application/octet-stream"
End Function
Problem is the GetObject requires the account underwhich this code runs to
be an Operator in WWW Service Master properties. It's undesirable to add
IUSR or IWAM as an operator.
I only want to read this information not edit. Is there any other way I can
resolve a file extension to a mime type in ASP code without elevated
priviledges?
Ta,
Anthony.
I use the following code to read the server's mimemap and resove a file
extension to a mime type:-
Public Function GetMimeType(ByVal Extension)
Dim oMimeMap
Dim vntMimeType
Dim avntMap()
Set oMimeMap = GetObject("IIS://LocalHost/MimeMap")
If Left(Extension, 1) <> "." Then Extension = "." & Extension
avntMap() = oMimeMap.MimeMap
For Each vntMimeType In avntMap
If vntMimeType.Extension = Extension Then
GetMimeType = vntMimeType.MimeType
Exit For
End If
Next
If GetMimeType = "" Then GetMimeType = "application/octet-stream"
End Function
Problem is the GetObject requires the account underwhich this code runs to
be an Operator in WWW Service Master properties. It's undesirable to add
IUSR or IWAM as an operator.
I only want to read this information not edit. Is there any other way I can
resolve a file extension to a mime type in ASP code without elevated
priviledges?
Ta,
Anthony.