Solved

Bizzare Security Issue with DirectoryEntry/Virtual Directory

Posted on 2004-04-17
5
223 Views
Last Modified: 2013-11-15
Hey everyone,

I'm having a heck of a time getting this to work:

DirectoryEntry root = new DirectoryEntry( "IIS://localhost/W3SVC/1/Root" );
DirectoryEntry vdir = root.Children.Add( "MyVirtualPath", "IIsWebVirtualDir" );
vdir.CommitChanges();

On commit changes, the following error occurs:

[UnauthorizedAccessException: Access is denied.]
   System.DirectoryServices.Interop.IAds.SetInfo() +0
   System.DirectoryServices.DirectoryEntry.CommitChanges()
   Default.Page_Load(Object sender, EventArgs e) in \\server\wwwroot$\userfolders\default.aspx.cs:39
   System.Web.UI.Control.OnLoad(EventArgs e)
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Page.ProcessRequestMain()

 The *only* way that I can get this to work is to add NETWORK SERVICE to the administrators group.  Seems sort of extreme.  Does anyone have any insight on what I need to do to my NETWORK SERVICE to allow it to CommitChanges to a DirectoryEntry object?  I've tried tweaking with the Local Policy privileges with little luck.  Also, this server is on a domain, so I'm not sure if that plays a role somehow (I tried looking in the Domain Policy and didn't see anything fishy).

Thanks!
0
Comment
Question by:TivexExchange
  • 2
5 Comments
 
LVL 28

Expert Comment

by:mmarinov
ID: 10852264
what is authentication for this virtual directory?
also have you remove the anonimous access to this virtual directory ?

B..M
0
 

Author Comment

by:TivexExchange
ID: 10854102
It's set to Windows Auth and yes I have removed annon. access.
0
 
LVL 28

Accepted Solution

by:
mmarinov earned 500 total points
ID: 10854709
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now