Version: 3.0.4.0
Add comprehensive secure file transfer capabilities to any .NET application.
That the Ftp component can retrieve data from an FTP server directly to memory rather than a file or store data in memory as a file on the server?
Data can be sent to the server from memory, or retrieved into memory, bypassing the need for unnecessary file I/O operations.
Code Sample:
//Store data from memory as a file on the server
System.IO.MemoryStream stream1 = new System.IO.MemoryStream(); 
byte[] data = System.Text.Encoding.ASCII.GetBytes("Some data");
stream1.Write(data, 0, data.Length); 
FtpFile file = ftp1.Put(stream1, "filefromstream.txt"); 

//Retrieve data from a file on the server into memory
System.IO.MemoryStream stream1 = new System.IO.MemoryStream(); 
FtpFile file = ftp1.Get("file1.txt", stream1); 
stream1.Position = 0;
Back to Top
That the Ftp component can send files using wildcards?
Wildcards can be used with the Ftp component to store or retrieve multiple files with one method call.
Code Sample:
//Put all files in "c:\Test" on the server
FtpFile[] files = ftp1.Put("c:\\Test\\files", "*", "/home", false); 
foreach(FtpFile file in files)
{
    if (file.Exception == null) 
        Debug.WriteLine(file.LocalFileName + " successfully stored"); 
}


//Get all text files in "home/directory1"
FtpFile[] files = ftp1.Get("/home/directory1", "*.txt", "c:\\Files", false); 
foreach(FtpFile file in files)
{
    if (file.Exception == null) 
        Debug.WriteLine(file.RemoteFileName + " successfully retrieved"); 
}
Back to Top
That an FTP listing is returned as a collection for easy data manipulation?
Each entry in a listing is an object, and is part of a returned collection.
Code Sample:
//Get the listing from the server
Listing listing = ftp1.List("*", true); 
// Iterate through each ListEntry 
foreach(ListEntry le in listing) 
{ 
    //Display generic fields (fields that are available whether the listing returned is UNIX or DOS)
    Debug.WriteLine(le.Path + le.Name);  // Display file path and name 
    Debug.WriteLine(le.Size);  //Display size
    Debug.WriteLine(le.TimeStamp);  //Display timestamp
 }
Back to Top
That the secure components can programmatically decide whether to accept a server certificate?
The secure components include a CertificateReceived event, which will fire when a certificate is received from a remote host. Code can be added to the event handler to programmatically determine whether a certificate should be accepted or not.
Code Sample:
private void myComponent_CertificateReceived(object sender, CertificateReceivedEventArgs e) 
{ 
    string msg = ""; 

    // Check to see if the certificate is from a trusted root. 
    if(!e.TrustedRoot) 
        msg += "This certificate is not from a trusted root\n"; 

    // Check to see if the certificate has a valid date. 
    if(!e.ValidDate) 
        msg += "This certificate does not have a valid date\n"; 

    // Check to see if the certificate has a valid name. 
    if(!e.ValidName) 
        msg += "This certificate does not have a valid name\n"; 

    if(msg != "") 
    { 
        msg += "Would you like to accept this certificate anyway?"; 
        if(MessageBox.Show(msg, "Invalid Cert Received", MessageBoxButtons.YesNo) == DialogResult.Yes) 
        { 
            // User wants to accept the invalid cert. Accept it. 
            e.Accept = true; 
        } 
    } 
}
Back to Top
That a component’s security can be enabled by setting a single property?
Simply setting the Security property allows the component to communicate with secure servers.
Code Sample:
// The component will be able to connect to an implicitly secure server
myComponent.Security = Security.Implicit;


Back to Top
That the certificate received from a server can be examined?
During the secure handshake, the Certificate Received event will fire, providing the user with information about the server’s certificate, as well as an opportunity to accept or reject the certificate, if desired.
Code Sample:
//The certificate received event will fire when the component receives the server's certificate
private void myObject1_CertificateReceived(object sender, CertificateReceivedEventArgs e) 
{ 
    //Examine who the certificate was issued to, and whether its date is valid
    if (e.Certificate.IssuedTo == "MyPrivateServer" && e.ValidDate == true)
        e.Accept = true;
    else
        e.Accept = false; 
}
Back to Top