unhandled exeption of type 'System.Runtime.InteropServices.COMException' in system directoryservices

  • Thread starter Thread starter cgian31
  • Start date Start date
C

cgian31

I am browsing the ActiveDirectory with the code below and I get the
error message in the subject, with Additional Information: Unspecified
error.

Any ideas?


string s=GetDomain;
DirectoryEntry de=new DirectoryEntry(s);

string sFilter = "(&(objectCategory=person)(objectClass=user))";
DirectorySearcher searcher = new DirectorySearcher(de);
searcher.Filter = sFilter;
searcher.SizeLimit = 10000;
searcher.PageSize = 0;
searcher.CacheResults = true;
searcher.SearchScope = System.DirectoryServices.SearchScope.Subtree;
SearchResultCollection results = searcher.FindAll();
 
What is the value of string s here? That is likely the problem.

Also, what context is this code running in? Is it a web or Windows app?

Joe K.
 
Thanks for your answer.
Actually the problem was in string s, which was not formatted properly
for the DirectoryEntry.
But why isn't the exception clearer???

Thanks again!
Joe Kaplan (MVP - ADSI) ha scritto:
 
Thanks for your answer.
Actually the problem was in string s, which was not formatted properly
for the DirectoryEntry.
But why isn't the exception clearer???

Thanks again!
 
Thanks for your answer.
Actually the problem was in string s, which was not formatted properly
for the DirectoryEntry.
But why isn't the exception clearer???

Thanks again!
 
What can I say? Sometimes the exceptions are not very good. Especially
when there are big problems with the binding string as the error may not
ever get into ADSI itself and might get stuck at the COM layer that is
trying to pick a provider.

Joe K.
 
Back
Top