[Mono-devel-list] Error 49 when calling System.DirectoryServices.DirectorySearcher.FindAll()

Boris Kirzner borisk at mainsoft.com
Wed Jul 27 02:37:50 EDT 2005

Hello Stephen,
Error code 49 is an LDAP error code that means you've supplied invalid 
You can check for more LDAP error codes here : 

If you want to investigate the exception cause, LdapException class has 
a number of message properties that should be updated
while raising an exception.

In addition - can you please provide us with a full stack trace so we'll 
be able to trace to the root of the problem?
Please make sure you're working with the latest version from svn, or , 
if you insist for some reason to work with some other version, provide 
the revision number.


STEPHEN W. COREY - 5535 wrote:

>I've got a C# console app that searches through MS Active Directory. The
>code works correctly in Windows. When running the same exe through mono
>(latest version) on a Red Hat 9 box, I get an exception, and the
>"Exception.Message" returns "49". That's all. No description or
>anything. Here's the code:
>String LDAPPath = "LDAP://NBDC01/ou=accounts,dc=master,dc=ws,dc=law";
>DirectoryEntry lRoot = new DirectoryEntry(LDAPPath, "myusername",
>DirectorySearcher lSearcher = new DirectorySearcher(lRoot);
>SearchResultCollection lResults = null;
>lResults = lSearcher.FindAll();
>An exception is raised on the last line (FindAll()). The Red Hat 9 box
>has Samba configured, and can communicate with the LDAP server via
>hostname or IP address. How can I find out what an Error 49 is, or
>better yet, how to fix this? Thanks!

Boris Kirzner
Mono R&D team, Mainsoft Corporation.
Blogging at http://boriskirzner.blogspot.com/

More information about the Mono-devel-list mailing list