tags:

views:

167

answers:

4

I have a problem with LDAP, I use apache directory server and I would add a new user .... I use Visual Studio and the code snippet is:

public static void prova(string FullName)
{          
   DirectoryEntry container;
   DirectoryEntries ChildEntry;

   container = new DirectoryEntry("LDAP://localhost:10389/cn=user1,ou=users,ou=system", "admin", "secret");

   try
   {
       ChildEntry = container.Children;
       DirectoryEntry NewEntry = ChildEntry.Add("cn=" + FullName, "user");
       NewEntry.CommitChanges();
       NewEntry.Close();
   }
   catch (Exception ex)
   {
       throw new Exception("Error " + ex.Message);
   }
}

The problem is that I have this type of error:

The directory service is not available

somebody could help me?

A: 

Is it possible to telnet to the server or connect with a LDAP browser e.g LdapExplorerTool: http://ldaptool.sourceforge.net/

telnet localhost 10389

If it's not possible the server is not responding and you show check your ldap server.

I think the main LDAP-port is 389 and it might be worth a try.

orjan
A: 

I tried with the port 389 but I'm still the same error ...... could be that ldap does not work with the new protocol ntlm2 of Windows Vista?

pepe_gaetano
A: 

It is as likely that your bind dn of admin is not sufficient.

You should be providing a full LDAP style DN for your LDAP user.

Like: cn=admin,ou=users,ou=system

(Seems unlikely that the root most object is of class OU, (your ou=system parts) but possible. Most LDAP implementations I have dealt with do not use this particular convention, rather they root the tree in an O= or a DC=. I suppose it depends on the specific schema if that is allowed).

geoffc
A: 

I tried with "uid=admin,ou=system,dc=example,dc=com" but I have the same error. for the O= or DC= I have apache server like server and apache studio for to look the users, the group etc and the convention is DC= CN= OU=. for this reason, the error isn´t that! what also can I do?

pepe_gaetano