473,466 Members | 1,462 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Querying IISMimeMap .. Access is denied .. HELP!

Code posted below ( I am not sure which group to post to, but I need help)

I wrote a Windows Form Application to query the IIS MimeMap on the localhost
which worked fine.

I ran the same code in asp.net and got "Access is Denied" exception.

What is the least permissions set I should grant the aspnet account to avoid
the exception.
Or any other suggest would be fine

Thanks.

Private Function CacheMimeMaps() As Specialized.StringDictionary

#If DEBUG Then

Dim starttime As DateTime = DateTime.Now

#End If

Dim entry As DirectoryServices.DirectoryEntry

Try

Dim mimeMaps As New Specialized.StringDictionary

entry = New DirectoryServices.DirectoryEntry("IIS://localhost/MimeMap")

Dim pvcMimeMap As DirectoryServices.PropertyValueCollection =
entry.Properties("MimeMap")

For Each o As Object In pvcMimeMap

Dim mt As IISOle.IISMimeType = CType(o, IISOle.IISMimeType)

mimeMaps.Add(mt.Extension, mt.MimeType)

#If DEBUG Then

Console.WriteLine("{0} = {1}", mt.Extension, mt.MimeType)

#End If

Next

' MimeMaps were found

If mimeMaps.Count > 0 Then

Me.Cache.Add(MIMEMAP, mimeMaps, Nothing, Cache.NoAbsoluteExpiration,
Cache.NoSlidingExpiration, Caching.CacheItemPriority.Low, Nothing)

Return mimeMaps

End If

pvcMimeMap = Nothing

Catch ex As Exception ' do nothing

Stop

Finally

#If DEBUG Then

Dim endtime As DateTime = DateTime.Now

Console.WriteLine(starttime.ToString() & "." &
starttime.Millisecond.ToString())

Console.WriteLine(endtime.ToString() & "." & endtime.Millisecond.ToString())

#End If

If (Not entry Is Nothing) Then

entry.Close()

entry.Dispose()

End If

End Try

End Function


Jul 19 '05 #1
2 2050
Access is denied because only admins can run that code.
By default, your code runs under a process for IIS that has no
administrative rights.

--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm

"Marlon" <mr***@exhibitworks.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Code posted below ( I am not sure which group to post to, but I need
help)

I wrote a Windows Form Application to query the IIS MimeMap on the
localhost
which worked fine.

I ran the same code in asp.net and got "Access is Denied" exception.

What is the least permissions set I should grant the aspnet account to
avoid
the exception.
Or any other suggest would be fine

Thanks.

Private Function CacheMimeMaps() As Specialized.StringDictionary

#If DEBUG Then

Dim starttime As DateTime = DateTime.Now

#End If

Dim entry As DirectoryServices.DirectoryEntry

Try

Dim mimeMaps As New Specialized.StringDictionary

entry = New DirectoryServices.DirectoryEntry("IIS://localhost/MimeMap")

Dim pvcMimeMap As DirectoryServices.PropertyValueCollection =
entry.Properties("MimeMap")

For Each o As Object In pvcMimeMap

Dim mt As IISOle.IISMimeType = CType(o, IISOle.IISMimeType)

mimeMaps.Add(mt.Extension, mt.MimeType)

#If DEBUG Then

Console.WriteLine("{0} = {1}", mt.Extension, mt.MimeType)

#End If

Next

' MimeMaps were found

If mimeMaps.Count > 0 Then

Me.Cache.Add(MIMEMAP, mimeMaps, Nothing, Cache.NoAbsoluteExpiration,
Cache.NoSlidingExpiration, Caching.CacheItemPriority.Low, Nothing)

Return mimeMaps

End If

pvcMimeMap = Nothing

Catch ex As Exception ' do nothing

Stop

Finally

#If DEBUG Then

Dim endtime As DateTime = DateTime.Now

Console.WriteLine(starttime.ToString() & "." &
starttime.Millisecond.ToString())

Console.WriteLine(endtime.ToString() & "." &
endtime.Millisecond.ToString())

#End If

If (Not entry Is Nothing) Then

entry.Close()

entry.Dispose()

End If

End Try

End Function


Jul 19 '05 #2
You can try to work with Impersonation
http://support.microsoft.com/default...b;en-us;306158

Regards
Roger
"Marlon" <mr***@exhibitworks.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Code posted below ( I am not sure which group to post to, but I need help)
I wrote a Windows Form Application to query the IIS MimeMap on the localhost which worked fine.

I ran the same code in asp.net and got "Access is Denied" exception.

What is the least permissions set I should grant the aspnet account to avoid the exception.
Or any other suggest would be fine

Thanks.

Private Function CacheMimeMaps() As Specialized.StringDictionary

#If DEBUG Then

Dim starttime As DateTime = DateTime.Now

#End If

Dim entry As DirectoryServices.DirectoryEntry

Try

Dim mimeMaps As New Specialized.StringDictionary

entry = New DirectoryServices.DirectoryEntry("IIS://localhost/MimeMap")

Dim pvcMimeMap As DirectoryServices.PropertyValueCollection =
entry.Properties("MimeMap")

For Each o As Object In pvcMimeMap

Dim mt As IISOle.IISMimeType = CType(o, IISOle.IISMimeType)

mimeMaps.Add(mt.Extension, mt.MimeType)

#If DEBUG Then

Console.WriteLine("{0} = {1}", mt.Extension, mt.MimeType)

#End If

Next

' MimeMaps were found

If mimeMaps.Count > 0 Then

Me.Cache.Add(MIMEMAP, mimeMaps, Nothing, Cache.NoAbsoluteExpiration,
Cache.NoSlidingExpiration, Caching.CacheItemPriority.Low, Nothing)

Return mimeMaps

End If

pvcMimeMap = Nothing

Catch ex As Exception ' do nothing

Stop

Finally

#If DEBUG Then

Dim endtime As DateTime = DateTime.Now

Console.WriteLine(starttime.ToString() & "." &
starttime.Millisecond.ToString())

Console.WriteLine(endtime.ToString() & "." & endtime.Millisecond.ToString())
#End If

If (Not entry Is Nothing) Then

entry.Close()

entry.Dispose()

End If

End Try

End Function

Jul 19 '05 #3

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

Similar topics

2
by: calfdog | last post by:
Hello, Does anyone know a workaround for calling fireEvent. With the latest from Microsoft OS XP2 and Hot fixes to IE it now gives an "access denied" error in Python when called. Here is what...
0
by: Steve | last post by:
Hi, Yesterday I signed up for another dedicated linux server with the hosting company I use and I am having problems getting MySQL 4.1.3 working on it. I've tried just about everything I can...
5
by: Jim Andersen | last post by:
Hi, I made a DTS-package and it works when I execute it manually, but when it is run by the SQL Server Agent, it fails. I have use the guide to create a maintenance plan. That doesn't work so...
3
by: Ian | last post by:
The beginning of my assembly that I am getting the access error from looks like this. ********************************* Imports System.EnterpriseServices Imports System Imports...
4
by: Fabian von Romberg | last post by:
Hi, I have installed Sql Reporting Services on 2 machines, one is WIN 2000 PRO and the other one is WIN 2000 ADV. SERVER. When I try to access a report using the webbrowser, I get the following...
9
by: | last post by:
Hi All, I have allready tried to ask a similar question , but got no answer until now. In the meantime, I found, that I cannot understand some thread-settings for the Main() function . If I use...
0
by: Marlon | last post by:
Code posted below I wrote a Windows Form Application to query the IIS MimeMap on the localhost which worked fine. I ran the same code in asp.net and got "Access is Denied" exception. What...
2
by: Marlon | last post by:
Code posted below ( I am not sure which group to post to, but I need help) I wrote a Windows Form Application to query the IIS MimeMap on the localhost which worked fine. I ran the same code...
0
by: private.anders | last post by:
Hi David! Really need assistance since I have been struggling with a problem long time now. I am running a web application on a Win 2003 Std (Active Directory). Everything works fine. I have...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.