Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Access denied for System.DirectoryServices

Hi,

We are developing a intranet web application through which our users can modify their  profile information(in Active Directory). I am getting an error which says like this

System.UnauthorizedAccessException: General access denied error

  at System.DirectoryServices.Interop.IAds.SetInfo()
  at System.DirectoryServices.DirectoryEntry.CommitChanges()

Here is my vb code block

---------------------------------------------------------------

            Dim dsUser As DirectoryEntry = New DirectoryEntry(sPath, "AdminID", "AdminPassword", AuthenticationTypes.Secure)
            dsUser = dsUser.Children.Find("CN=John")
            With dsUser.Properties
                .Item("displayname").Value = "John Doe"
            End With
            dsUser.CommitChanges()
--------------------------------------------------------------

I am getting the above error while calling CommitChanges. Am I missing anything on ASPNET user account? Any thoughts?

Ram
Tuesday, August 05, 2003

Try "DomainName\AdminID" as the username.

Duncan Smart
Tuesday, August 05, 2003

Nope, getting the same error. I tried to login using the admin account and changing the user profile information (using the active directory maintenance tab) and I was able to successfully update and so the user has enough rights.

Ram
Wednesday, August 06, 2003

I never discovered what the required rights were for ADSI updates, but for sure, I know that the ASPNET account doesn't have them.

Brad Wilson (dotnetguy.techieswithcats.com)
Wednesday, August 06, 2003

Finally it is working. The reason was whatever account I was trying to update were disabled or inactive for some reason and when I tried to update my own account, I found that it is working!!

Ram
Friday, August 08, 2003

*  Recent Topics

*  Fog Creek Home