Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 09, 2009 12:14 PM by ledo_moon
Aug 04, 2008 12:14 PM|LINK
When i try to List the users from Active directory, i get this exception.
Error while processing.System.Runtime.InteropServices.COMException (0x80072020): An operations error occurred at System.DirectoryServices.DirectoryEntry.Bind(Boolean
throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindAll()
The code i used is :
deSearch.Filter = "(&(objectClass=user) (cn=" + UserName +"))";
SearchResultCollection results = deSearch.FindAll();
But the DirectoyEntry method is getting validated if i use the overloaded method :
DirectoryEntry(_path, domainAndUsername, password);
Please advice me.
Aug 04, 2008 03:00 PM|LINK
The most likely reason is that the user account in whose context your code is executing (aspnet or network service) does not have sufficient rights. Impersonate a domain account and it should work.
Aug 07, 2008 02:23 PM|LINK
Thanks for your response.
I am new to Active directory can you please tell me the step by step procedure to " Impersonate a domain account ".
Thank in advance.
Aug 07, 2008 11:35 PM|LINK
You can check the following
For page level impersonation using web.config
To implement it programmatically
Aug 08, 2008 10:54 AM|LINK
Thank you When i tried with the method with <identity impersonate ="true"> i got the asme issue.
When i used <identity impersonate="true"
I got this error : "Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'Unspecified error '
Thank you very much for your reply !
Aug 09, 2008 01:18 AM|LINK
<identity impersonate="true" userName="domain\someUserName" password="password"/>
Here domain is the name of the domain in which a user someUserName exists.
Aug 11, 2008 11:23 AM|LINK
The same exception is coming at this method.
The error which i mentioned at first. SearchResultCollection results = deSearch.FindAll()
Dec 09, 2009 12:14 PM|LINK
Create Active Directory Service using WCF – Accusing AD Functions using WCF Services – AD Services