473,385 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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


Nov 18 '05 #1
2 1135
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


Nov 18 '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

Nov 18 '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...
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: Ryan Schefke | last post by:
------=_NextPart_000_0077_01C34C8B.2B90C960 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ..I just sent this out to the win32 distribution list but no one has...
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...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.