ComponentPro UltimateFtp

      Handle errors

      Language Filter: AllSend comments on this topic to ComponentPro

      Exceptions thrown by the component and its dependencies can easily be caught by using try catch block. The table below lists all exceptions that can be caught when using the component: 

      Exception Description
      UltimateLicenseException The exception that is thrown when an error occurs while checking the license.
      FtpException The exception that is thrown when an FTP error occurs.
      ProxySocketException The exception that is thrown when a proxy error or socket error occurs.


      The example below shows how to handle exceptions:

      using System;
      using ComponentPro.IO;
      using ComponentPro.Net;
      // Create a new Ftp instance.
      Ftp client = new Ftp();
          // Connect to the FTP server. 
          // Authenticate. 
          client.Authenticate("userName", "password");
          // ... 
          // Create 'myFolder' folder. 
          // ... 
          // Disconnect. 
      catch (FtpException exc)
          if (client.IsConnected)
          Console.WriteLine("An error occurred: " + exc.Message);