The bind operation allows the entry to authenticate to the server. An entry in a directory is uniquely identified using its distinguished name (DN). A client application can choose to bind to the directory using an identity (DN and password) or anonymously. The C# code snippet below shows how to bind a user entry to an LDAP server:
// C# Library namespace using Novell.Directory.Ldap;
// Creating an LdapConnection instance LdapConnection ldapConn= new LdapConnection();
//Connect function will create a socket connection to the server ldapConn.Connect (ldapHost,ldapPort);
//Bind function with null user dn and password value will perform anonymous bind to LDAP server ldapConn.Bind (null, null);
// C# Library namespace using Novell.Directory.Ldap;
// Creating an LdapConnection instance LdapConnection ldapConn= new LdapConnection();
//Connect function will create a socket connection to the server ldapConn.Connect(ldapHost,ldapPort);
//Bind function will Bind the user object Credentials to the Server ldapConn.Bind(userDN,userPasswd);