Novell.Directory.Ldap.LdapConnection.Disconnect C# (CSharp) Method

Disconnect() private method

Synchronously disconnect from the server
private Disconnect ( LdapConstraints cons, bool how ) : void
cons LdapConstraints
how bool true if application call disconnect API, false if finalize. ///
return void
        private void Disconnect(LdapConstraints cons, bool how)
        {
            // disconnect doesn't affect other clones
            // If not a clone, distroys connection
            conn = conn.destroyClone(how);
            return ;
        }

Same methods

LdapConnection::Disconnect ( ) : void
LdapConnection::Disconnect ( LdapConstraints cons ) : void

Usage Example

        public bool CheckUser(string UserName, string OldPassword)
        {
            bool   result = true;
            string User   = UserName;
            string Pass   = OldPassword;

            // Creating an LdapConnection instance
            Novell.Directory.Ldap.LdapConnection ldapConn = new Novell.Directory.Ldap.LdapConnection();

            string dn = "uid = " + UserName + ",ou=users,dc=example,dc=com";

            try
            {
                //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(dn, OldPassword);
            }

            catch (Novell.Directory.Ldap.LdapException e)
            {
                TempData["msg"] = "<script>alert('Could not authenticate user!');</script>";
                result          = false;
                return(result);
            }

            finally
            {
                // Disconnect from LDAP
                ldapConn.Disconnect();
            }

            return(result);
        }
All Usage Examples Of Novell.Directory.Ldap.LdapConnection::Disconnect