[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Bizzare Security Issue with DirectoryEntry/Virtual Directory

Posted on 2004-04-17
5
Medium Priority
?
263 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
3 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 2000 total points
ID: 10854709
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses

873 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