FtpClient.Connect Method

System.Net.FtpClient

Collapse image Expand Image Copy image CopyHover image
Connect to the server. Throws ObjectDisposedException if this object has been disposed.

Namespace: System.Net.FtpClient
Assembly: System.Net.FtpClient (in System.Net.FtpClient.dll) Version: 1.0.5064.17461

Syntax

C#
public virtual void Connect()
Visual Basic
Public Overridable Sub Connect
Visual C++
public:
virtual void Connect()

Implements

IFtpClient..::..Connect()()()()

Examples

C#  Copy imageCopy
using System;
using System.Net;
using System.Net.FtpClient;

namespace Examples {
    public static class ConnectExample {
        public static void Connect() {
            using (FtpClient conn = new FtpClient()) {
                conn.Host = "localhost";
                conn.Credentials = new NetworkCredential("ftptest", "ftptest");
                conn.Connect();
            }
        }
    }
}

See Also