Search code examples
c#active-directoryldaptimeout

What is a default timeout for ldap connection


I have Ldap connection.Please find below the code snippet :-

 public LdapConnection BindLDAPConnection()
    {
        var flag = 0;
        _ldapConnectionUsers = GetLDAPConnection();
        _ldapConnectionUsers.AuthType = AuthType.Basic;
        _ldapConnectionUsers.SessionOptions.SecureSocketLayer = false;
        _ldapConnectionUsers.SessionOptions.ProtocolVersion = 3;
        _ldapConnectionUsers.SessionOptions.VerifyServerCertificate =
  ServerCallback;
        //ldap.SessionOptions.VerifyServerCertificate =
        //      (con, cer) => true;
         password = GetPasswordForUser();
         NetworkCredential network = LdapHelper.GetNetworkCredentials();
        _ldapConnectionUsers.Timeout=new TimeSpan(0,0,10,0);
         _ldapConnectionUsers.Bind(network);
         return _ldapConnectionUsers;
    }

In the configuration part, I need to set the timeout for this connection.

What is the default timeout for ldap connection?

So that I can give that default timeout in the configuration part?


Solution

  • LdapConnection.Timeout overrides DirectoryConnection.Timeout that defaults to 30 seconds.