Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.4k views
in .NET FTP by (300 points)
Hello all,

I am using EnterpriseDT/PRO for C#.net. I have been successfully using it for years for standard FTP site uploads and downloads. One of my clients is switching their FTP site to SFTP. In order to connect I have changed the 'FileTransferProtocol' property to 'SFTP', the 'FTPConnectMode' to 'PASV' and the 'ServerPort' to 22. I can connect successfully. However, when I attempt to download a file (i.e. take a file from the server and retrieve to my machine), I get a file not found error.

Now, I know the file is there as I can see it using CoreFTPLite on my client machine. To add some further perspective to this, I am also using SmartFTP on my client machine. I can connect successfully to the SFTP site using the same settings as mentioned above, however, I cannot see any files or folders. Therefore, the same problem seems to be occuring on SmartFTP and the EnterpriseDT solution that is blocking me from accessing files and folders that CoreFTP does allow me to see.

This makes me believe that there is a property or setting on EnterpriseDT (and SmartFTP), perhaps some kind of filter, that is blocking me from accessing files and folders. Do you agree with this assessment? And if so, then what property needs to be changed on EnterpriseDT to allow me to access the files on the site?

TIA for all help in this matter.

Bob

3 Answers

0 votes
by (51.6k points)
Hi Bob

There's no filter in edtFTPnet/PRO that would prevent downloading files. One possibility is that the path that you need to use for SFTP is different to the one you need to use for FTP. Try connecting to the server, printing the path of the home directory and then getting a listing of the directory to see what's in it.

- Hans (EnterpriseDT)
0 votes
by (300 points)
Hello Hans,

The path is fine. The login/password combination takes me to the proper directory. As I mentioned, when I connect using CoreFTP using the same credentials, I get the files and folders listed as expected but Enterprise/Pro does not.

If you can think of anything else, please let me know.

Thanks again.

Bob
0 votes
by (51.6k points)
Please run the following program:
Logger.CurrentLevel = Level.ALL;
Logger.PrimaryLogFile = "edtftpnetpro.log";
Logger log = Logger.GetLogger("Test");

try
{
    SecureFTPConnection ftp = new SecureFTPConnection();
    ftp.Protocol = FileTransferProtocol.SFTP;
    ftp.UserName = "yourusername";
    ftp.Password = "yourpassword";
    ftp.Connect();
    log.Info(ftp.ServerDirectory);
    string fileName = null;
    foreach (FTPFile f in ftp.GetFileInfos())
    {
        log.Info("  " + f.Name);
        if (fileName == null && !f.Dir)
            fileName = f.Name;
    }
    if (fileName != null)
    {
        log.Info("Downloading " + fileName);
        ftp.DownloadFile(fileName, fileName);
        log.Info("Downloaded " + fileName);
    }
    else
        log.Warn("No files found");
    ftp.Close();
}
catch (Exception ex)
{
    log.Error(ex);
}

You'll need these references:
using EnterpriseDT.Net.Ftp;
using EnterpriseDT.Util.Debug;


when it's done, zip up the log file and e-mail it to support@enterprisedt.com.

- Hans (EnterpriseDT)

Categories

...