Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Reading the server mimemap.

Reply
Thread Tools

Reading the server mimemap.

 
 
Anthony Jones
Guest
Posts: n/a
 
      02-21-2006
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.


 
Reply With Quote
 
 
 
 
Per
Guest
Posts: n/a
 
      03-14-2006
Hi,

I have the same problem!
How can I set read permissions for the IUSR_MACHINENAME to retrieve the
"IIS://LocalHost/MimeMap" values.
Is there another way to retrieve these values without administrative rights.


Regards,

Per Dunberg


"Anthony Jones" wrote:

> 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.
>
>
>

 
Reply With Quote
 
 
 
 
aa
Guest
Posts: n/a
 
      10-18-2006
a
---
Posted via DotNetSlackers.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
UnauthorizedAccessException when reading XML files (no problem when reading other file-types) blabla120@gmx.net ASP .Net 0 09-15-2006 02:08 PM
DVD ROM not reading DVDs but reading CDs sayeed.afzal@gmail.com Computer Information 0 05-22-2006 10:37 AM
Server to server = Server client to server? - Java 2 07-29-2005 10:46 PM
ASP.NET Reading problem (reading .xls) Wael Soliman ASP .Net 2 01-03-2005 05:33 PM
reading the DB vs. reading a text file...performance preference? Darrel ASP .Net 3 11-11-2004 02:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57