LDAP Client.Net

Client.Connect Method (String, Int32, String, String, Boolean)

Authenticate and bind to a directory server.

[Visual Basic]
Public Sub Connect( _ 
   ByVal serverName As String, _ 
   ByVal port As Integer, _ 
   ByVal userName As String, _ 
   ByVal password As String, _ 
   ByVal useSSL As Boolean _ 
)
[C#]
public void Connect(
   string serverName,
   int port,
   string userName,
   string password,
   bool useSSL
);
[C++]
public: void Connect(
   String* serverName,
   int port,
   String* userName,
   String* password,
   bool useSSL
);
[JScript]
public function Connect(
   String serverName,
   int port,
   String userName,
   String password,
   bool useSSL
);

Parameters

serverName
Name of the server.
port
Communication port.
userName
Username to bind as.
password
Password for the given username.
useSSL
true to bind using SSL; false to bind using unencrypted transport.

Example

[C#]
using System;
using LdapServices.Ldap;

namespace LDAPSampleCodeConsole
{
class SampleApp
{
static void Main(string[] args)
{
Client client = new Client();
client.Connect("directory.yourCompany.ca", 389, "username", "password", true);
// This connection to 'your server' through port 389 uses SSL and is ready for a search.

// Disconnect
client.Disconnect();
}
}
}

See Also

Client Class | LdapServices.Ldap Namespace | Client.Connect Overload List