CommitChanges - General access denied errorhttp://forums.asp.net/t/301702.aspx/1?CommitChanges+General+access+denied+errorWed, 09 Jan 2013 14:36:10 -0500301702301702http://forums.asp.net/p/301702/301702.aspx/1?CommitChanges+General+access+denied+errorCommitChanges - General access denied error 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 <pre class="prettyprint">--------------------------------------------------------------- Public sPath As String = &quot;LDAP://domainname/OU=OITS,OU=ODI,DC=aa,DC=bb,DC=cc,DC=dd&quot; Dim dsUser As DirectoryEntry = New DirectoryEntry(sPath, &quot;domain/AdminID&quot;, &quot;AdminPassword&quot;, AuthenticationTypes.Secure) dsUser = dsUser.Children.Find(&quot;CN=John&quot;) With dsUser.Properties .Item(&quot;displayname&quot;).Value = &quot;John Doe&quot; End With dsUser.CommitChanges() --------------------------------------------------------------</pre> I am getting the above error while calling CommitChanges. Am I missing anything on ASPNET user account? Any thoughts? 2003-08-06T17:42:47-04:00301891http://forums.asp.net/p/301702/301891.aspx/1?Re+CommitChanges+General+access+denied+errorRe: CommitChanges - General access denied error It is probably not transferring credentials to the user DirectoryEntry. Instead of reusing the DirectoryEntry 'dsUser', try creating a new one, the credentials might transfer in this case, if not then bind to it again using password and username:<pre class="prettyprint">Dim entry As DirectoryEntry = New DirectoryEntry(sPath, &quot;domain/AdminID&quot;, &quot;AdminPassword&quot;, AuthenticationTypes.Secure) Dim dsUser as DirectoryEntry = entry.Children.Find(&quot;CN=John&quot;) 'Optionally Define username and password in case they are not xferring 'dsUser.Username = &quot;domain\adminid&quot; 'dsUser.Password = &quot;AdminPassword&quot; With dsUser.Properties .Item(&quot;displayname&quot;).Value = &quot;John Doe&quot; End With dsUser.CommitChanges()</pre> 2003-08-06T19:48:12-04:00301940http://forums.asp.net/p/301702/301940.aspx/1?Re+CommitChanges+General+access+denied+errorRe: CommitChanges - General access denied error Ryan, Nope it gives out the same error. I tried the same code in Console application to figure out whether it is due to Web application but it does not work there either. looks like for some reason, it could not copy the changes from cache to Active Directory store. I tried debugging after I assign the value to the properties collection and it was there but the moment I call commitchanges function, it throws me an exception. Ram 2003-08-06T20:19:24-04:00302752http://forums.asp.net/p/301702/302752.aspx/1?Re+CommitChanges+General+access+denied+errorRe: CommitChanges - General access denied error I am not sure on this one - the code should be working fine. It could be that your Admin account you are binding as does not have proper permissions. It could also be that your user &quot;CN=John&quot;, is an admin and a lower permission account is trying to update it (which would fail). Can you confirm this is not happening? 2003-08-07T15:41:23-04:00303792http://forums.asp.net/p/301702/303792.aspx/1?Re+CommitChanges+General+access+denied+errorRe: CommitChanges - General access denied error 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!! shame on me I should have tried more different cases. thanks anyway for all your inputs. 2003-08-08T12:55:56-04:003195902http://forums.asp.net/p/301702/3195902.aspx/1?Re+CommitChanges+General+access+denied+errorRe: CommitChanges - General access denied error <p>Can anybody help please?</p> <p>This is a C# console App where I am getting the same error ( General access denied <a>error</a>&nbsp;- @CommitChanges ) when&nbsp;i try&nbsp;&nbsp;to update by using UID who has only &quot;<span style="font-size:10pt; font-family:'Verdana','sans-serif'">Account Operator<font face="Arial">&quot; permission but it works fine if UID has <span style="font-size:10pt; font-family:'Verdana','sans-serif'">Enterprise Admin permissions. But we dont want to use <span style="font-size:10pt; font-family:'Verdana','sans-serif'">Enterprise Admin for this purpose. </span></span></font></span></p> <p><span style="font-size:10pt; font-family:'Verdana','sans-serif'"><font face="Arial"><span style="font-size:10pt; font-family:'Verdana','sans-serif'"><span style="font-size:10pt; font-family:'Verdana','sans-serif'">Please suggest.<br> </span></span></font></span><span style="font-size:10pt; font-family:'Verdana','sans-serif'"><font face="Arial"><span style="font-size:10pt; font-family:'Verdana','sans-serif'"><span style="font-size:10pt; font-family:'Verdana','sans-serif'">Thanks,<br> Harish</span></span></font></span></p> 2009-05-29T10:06:23-04:003196799http://forums.asp.net/p/301702/3196799.aspx/1?Re+CommitChanges+General+access+denied+errorRe: CommitChanges - General access denied error <p>In our AD, there are some &quot;service accounts&quot; that have update account permissions. These do not need to have Enterprice Admin permissions. These accounts are further locked down by:</p> <p>user cannot change the password</p> <p>user cannot login to devices.</p> <p>We programmers are given the credentials of the service account for AD manipulation.</p> <p>Hope this helps.</p> <p>&nbsp;</p> 2009-05-29T16:05:13-04:003606287http://forums.asp.net/p/301702/3606287.aspx/1?Re+CommitChanges+General+access+denied+errorRe: CommitChanges - General access denied error <p>Hi I have a question about the same, I was given the service account, this seemed to work quite well for most of the users except a few, could there be a clash in the user permissions to allow them to edit for those particular group of users??</p> <p><br> </p> <p>Eg. Can a service account be used to edit information of a Domain Admin?</p> 2010-01-08T16:46:06-05:003676775http://forums.asp.net/p/301702/3676775.aspx/1?Re+CommitChanges+General+access+denied+errorRe: CommitChanges - General access denied error <p></p> <blockquote><span class="icon-blockquote"></span> <h4>rishi23</h4> <p>Hi I have a question about the same, I was given the service account, this seemed to work quite well for most of the users except a few, could there be a clash in the user permissions to allow them to edit for those particular group of users??</p> <p><br> </p> <p>Eg. Can a service account be used to edit information of a Domain Admin?</p> <p></p> </blockquote> It depends on how the permissions are applied to the AD structure. It's possible the account you are using has permission to update user accounts only in certain OUs. This is a very specific permission in AD. <p></p> <p></p> <p>Are all the accounts you can successfully change in a single OU / Sub-OU tree? Are the accounts you are having trouble with in OUs that are outside of that tree? If the answers to the above questions are both &quot;yes&quot;, then you may need to apply the update permissions for that service account&nbsp;to the other OUs or apply the permissions&nbsp;at a higher level in the OU structure.</p> <p>&nbsp;</p> 2010-02-12T18:25:44-05:003687476http://forums.asp.net/p/301702/3687476.aspx/1?Re+CommitChanges+General+access+denied+errorRe: CommitChanges - General access denied error <p>Hi everyone,</p> <p>I had the same error message working on a 64-bit Windows 2008 Domain Controller.&nbsp; I fixed it by&nbsp;turning UAC off (user access control).&nbsp; You may be running into similar problems if you're running your script on any station that user&nbsp;UAC (Vista, Windows 7, Server 2008).&nbsp;</p> <p>*Please note - in my case my script would not make any edits, so this probably will not be the fix in cases where some modifications are working and others are not*</p> <p>Best of luck all!</p> <p>&nbsp;</p> 2010-02-18T14:56:52-05:004834810http://forums.asp.net/p/301702/4834810.aspx/1?Re+CommitChanges+General+access+denied+errorRe: CommitChanges - General access denied error <p>Hi All,</p> <p>Is there a better workaround to the above issue (General Access denied error on Windows 2008 domain controller) than turning off UAC?</p> <p>I have a c#console application which updates a custom AD field.</p> <p>When I add&nbsp;my username/password credentials to the DirectoryEntry connection it works fine.</p> <p>If I don't, it comes up with the General Access Denied error (even though I'm logged in with the saem account).</p> <p>&nbsp;</p> 2012-02-16T01:16:07-05:005264680http://forums.asp.net/p/301702/5264680.aspx/1?Re+CommitChanges+General+access+denied+errorRe: CommitChanges - General access denied error <p></p> <blockquote><span class="icon-blockquote"></span> <h4>Gitfinger</h4> <p></p> <p>Hi All,</p> <p>Is there a better workaround to the above issue (General Access denied error on Windows 2008 domain controller) than turning off UAC?</p> <p>I have a c#console application which updates a custom AD field.</p> <p>When I add&nbsp;my username/password credentials to the DirectoryEntry connection it works fine.</p> <p>If I don't, it comes up with the General Access Denied error (even though I'm logged in with the saem account).</p> <p>&nbsp;</p> <p></p> </blockquote> <p></p> <p></p> <p>You have to impersonate your application as the service account. If it's a console app then Right click &quot;Run As user&quot; then run at it as the service accounts credential or If its a web app then in IIS from the application pool you would have to define its identity as the service account.</p> <p></p> <p>Hope this helps</p> 2013-01-09T14:36:10-05:00