473,503 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading the server mimemap.

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.
Feb 21 '06 #1
2 2699
Per
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.

Mar 14 '06 #2
aa
a
---
Posted via DotNetSlackers.com
Oct 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
5964
by: javastudent | last post by:
Hi, I am implementing a server that reads for socket connections at a port, and processes the socket on a separate thread. We do not control the client implementation. Here is the scenario. ...
1
2747
by: Boris Wilhelms | last post by:
Hello all, at first, sorry for my bad English, I’ll give my best  We have a strange problem reading Text- and VarChar-Fields. Our configuration: -Windows 2003 Server -MySQL Server 3.23.36...
0
489
by: Dave | last post by:
IIS has an object called a MimeMap that I need to create so I can set some properties (mime types) during installation of a web service. In VB I can use the statement: Dim newMimeMap =...
4
2275
by: JoelWhitehouse | last post by:
Hi! I want to write a script that will read a .php file on a remote server and print to the current page a portion of the text contained in the remote file. I am just wondering what the best...
21
13024
by: JoKur | last post by:
Hello, First let me tell you that I'm very new to C# and learning as I go. I'm trying to write a client application to communicate with a server (that I didn't write). Each message from the...
3
2095
by: Nelson R. | last post by:
Hi, im using a form to get some input from the user. This form is in a HTML file. When I post the form directly to my email, i receive all fields correctly. Example test.html: <FORM...
2
2236
by: Kevin R | last post by:
I'm trying to get asp.net 1.1 running on my home PC. When I try creating a new ASP.NET Web Application in 'Visual Studio .NET 2003' I get the following error: "Visual Studio .NET has detected...
9
5487
by: Mike Reed | last post by:
I must be having a "senile" day! I cannot recall, nor get to work, code to read a cookie's expiration date/time in an ASP page/VBScript. What am I missing? *** Sent via Developersdex...
5
32415
by: xoise | last post by:
Warning: mysql_connect() : Lost connection to MySQL server at 'reading initial communication packet', system error: 113 in /webs/sites/monetized.com/includes/mysql_connect.inc.php on line 2 Lost...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.