edtFTPnet/PRO - Secure FTP component for .NET | Free Trial | Pricing
Main interface to edtFTPnet/PRO's FTP functionality.

Namespace: EnterpriseDT.Net.Ftp.Pro
Assembly: edtFTPnetPRO (in edtFTPnetPRO.dll) Version: 8.0.0.20

Syntax

C#
public class ProFTPConnection : FTPConnection
Visual Basic
Public Class ProFTPConnection _
	Inherits FTPConnection
Visual C++
public ref class ProFTPConnection : public FTPConnection

Remarks

OBSOLETE. Use SecureFTPConnection.

A ProFTPConnection object represents a unique connection to an FTP server. It offers a broad range of properties and events, as well as a full complement of asynchronous methods that are especially helpful for improving the responsiveness of Windows Forms application. ProFTPConnection is a .NET component that may be dropped onto a design-surface in an IDE and configured using a property editor or the ProFTPConnection Designer (see below).

Connections are not opened until the Connect()()()() method is called. Connection-, Authentication-, and Security-related properties should be set prior to opening the connection.

At a minimum, the following properties must be set prior to connection.

PropertyDescription
ServerAddressThe domain-name or IP-address of the server.
UserNameUser-name of account on the server.
PasswordPassword of account on the server.

The ProFTPConnection Designer may be used to assist with setting these and other properties. It allows the developer to test various property-settings interactively without running their application. The Connection Designer may be accessed by (1) double-clicking on the component, (2) right-clicking on the component and selecting "Connection Designer" from the context menu, or (3) selecting the component and then clicking on the "Connection Designer" link at the bottom of the Properties View.

The developer may set properties from within the Connection Designer and test them by pressing the "Connect" button. Once connected, transfers may be tested by dragging from one file-list to the other. A command-log and a debug-log is shown at the bottom of the window.

Secure Transfers are enabled through the Security properties. At a minimum, the SecureFTPType should be set to FTPSExplicit or FTPSImplicit, representing explicit FTPS and implicit FTPS, respectively. The issue of Server Validation must also be addressed.

Server Validation is the process of making sure that the server with which the client is communicating is indeed the intended server. While developing code, this process may be disabled by setting ServerValidation to None, which disables server validation, but this should not be done in deployed applications.

To achieve server validation, the ServerValidation property may be set to Automatic or AutomaticNoNameCheck and a Certificate that is able to verify the FTP server must be installed on the machine on which the FTP client software is running. This certificate may be either the certificate of the server itself, or the certificate of the Certificate Authority (CA). edtFTPnet/PRO provides various means of installing server certificates:

  • Design-Time - The Certificate Manager GUI may be displayed at design-time by (1) right-clicking on the component and selecting "Certificate Manager" from the context menu, or (2) selecting the component and then clicking on the "Certificate Manager" link at the bottom of the Properties View.
  • Runtime GUI - The Certificate Manager GUI may be displayed at runtime by using the ProFTPCertificate.ShowCertificateManager method.
  • Runtime Programmatic - Certificates may be imported into the operating system's Certificate Stores using the Import methods of ProFTPCertificate.
  • Microsoft Management Console (MMC) - The Microsoft Management Controls (MMC) may be used for managing the operating system's certificate stores.

ProFTPConnection supports Asynchronous Operations. These are particularly useful in improving the responsiveness of GUI applications since they allow the application to keep processing user input while FTP operations are taking place. Asynchronous operations are automatically queued such that, if an asynchronous operation is requested while another is under way, it will automatically be queued to begin once the previous one has completed.

Asynchronous operations are supported by means of a large number of Begin___() and End___() methods. Nearly every synchronous method offered in FTPConnection and ProFTPConnection has matching asynchronous operations in the form of a matching Begin___() and End___() pair of methods. The following example illustrates the use of

 Copy imageCopy
            	private void button1_Click(object sender, System.EventArgs e)
            	{
            		proFTPConnection1.BeginDownloadFile(fileName, fileName, new AsyncCallback(DownloadComplete), fileName);
            	}
            	
            	private void DownloadComplete(IAsyncResult ar)
            	{
            		proFTPConnection1.EndDownloadFile(ar);
            		label1.Text = "Finished downloading " + (string)ar.AsyncState;
            	}
            

The button1_Click method initiates the download using the BeginDownloadFile(String, String, AsyncCallback, Object) method and returns immediately (i.e. before the file has been downloaded). The DownloadComplete method is then called once the file has been downloaded allowing us to notify the user of this fact. Since the download happens in the background the application may perform other processing while the file is being downloaded.

Inheritance Hierarchy

System..::..Object
  System..::..MarshalByRefObject
    System.ComponentModel..::..Component
      EnterpriseDT.Net.Ftp..::..FTPConnection
        EnterpriseDT.Net.Ftp.Pro..::..ProFTPConnection

See Also