In the case of such errors in FTP protocol, the status of the FtpException is set to ProtocolError. So use a try catch block and look for the FtpException with such status. Then you can access the FTP response code and message via properties (see code below).
Ftp ftp = new Ftp();
// connect and login
// some FTP operation
catch (FtpException ex)
if (ex.Status == FtpExceptionStatus.ProtocolError)
// use the following properties to report what is going on:
Unfortunately, the FTP protocol only returns a code and a message and there is not one easy recipe to differentiate whether it is "access denied", "folder not found" or other error, as the messages can be different for each server and each 'problem type'. So we do not provide API for this. If you are using only a few particular servers, you might and the error codes are the same, you might test the error description and distinguish based on that. But if you plan to support any FTP server, then a suggested behavior is to report/ log the error and let the user decide what to do.