public async Task <LdapConnection> GetLdapConnection()
 {
     try
     {
         var flag = 0;
         _ldapConnectionUsers          = GetLDAPConnection();
         _ldapConnectionUsers.AuthType = AuthType.Basic;
         _ldapConnectionUsers.SessionOptions.SecureSocketLayer       = false;
         _ldapConnectionUsers.SessionOptions.ProtocolVersion         = 3;
         _ldapConnectionUsers.SessionOptions.VerifyServerCertificate =
             ServerCallback;
         _ldapConnectionUsers.SessionOptions.VerifyServerCertificate =
             (con, cer) => true;
         password = GetPasswordForUser();
         NetworkCredential network = LdapHelper.GetNetworkCredentials();
         LdapHelper.network           = network;
         _ldapConnectionUsers.Timeout = new TimeSpan(0, 0, 1, 0);
         _ldapConnectionUsers.Bind(network);
         Thread.Sleep(180000);
         return(_ldapConnectionUsers);
     }
     catch (Exception ex)
     {
     }
     return(_ldapConnectionUsers);
 }
Exemple #2
0
        public LdapConnection BindLDAPConnection()
        {
            var flag = 0;

            _ldapConnectionUsers          = GetLDAPConnection();
            _ldapConnectionUsers.AuthType = AuthType.Basic;
            _ldapConnectionUsers.SessionOptions.SecureSocketLayer       = true;
            _ldapConnectionUsers.SessionOptions.ProtocolVersion         = 3;
            _ldapConnectionUsers.SessionOptions.VerifyServerCertificate =
                ServerCallback;
            password = GetPasswordForUser();
            NetworkCredential network = LdapHelper.GetNetworkCredentials();

            LdapHelper.network           = network;
            _ldapConnectionUsers.Timeout = new TimeSpan(0, 0, 1, 0);
            _ldapConnectionUsers.Bind(network);
            return(_ldapConnectionUsers);
        }