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

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();
 
J

Joe Kaplan \(MVP - ADSI\)

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.
 
C

cgian31

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:
 
C

cgian31

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!
 
C

cgian31

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!
 
J

Joe Kaplan \(MVP - ADSI\)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top