Topic "FTPS error: Operation not permitted"

Author Message
jgorodriguez
[View user's profile]

Joined: 2016-03-17
Posts: 1
Hi,

I have problem with FTPS connection. When I try to download files from server (session.GetFiles), I get the next error: "Copying files from remote side failed. Unable to build data connection: Operation not permitted."

This is my code:

SessionOptions sessionOptions = new SessionOptions
{
FtpMode = FtpMode.Passive,
Protocol = Protocol.Ftp,
FtpSecure = FtpSecure.Explicit,
HostName = strFtpUrl,
PortNumber = strFtpPort,
UserName = strFtpUser,
Password = strFtpPass,
TlsHostCertificateFingerprint = strFtpHostKey,
Timeout = TimeSpan.FromSeconds(60)
};
sessionOptions.AddRawSettings("ProxyMethod", "3");
sessionOptions.AddRawSettings("ProxyHost", ConfigurationManager.AppSettings["UrlProxy"]);
sessionOptions.AddRawSettings("ProxyPort", ConfigurationManager.AppSettings["PortProxy"]);
sessionOptions.AddRawSettings("ProxyUsername", ConfigurationManager.AppSettings["UserProxy"]);
sessionOptions.AddRawSettings("ProxyPassword", ConfigurationManager.AppSettings["PassProxy"]);

using (Session session = new Session())
{
//session.DisableVersionCheck = true;
session.Open(sessionOptions);

var transferOptions = new TransferOptions {TransferMode = TransferMode.Ascii};
transferOptions.ResumeSupport.State = TransferResumeSupportState.Off;

// Download the files in the OUT directory.
var transferOperationResult = session.GetFiles(strFtpFullPath, strDestFullPath, false, transferOptions);

// Check and throw if there are any errors with the transfer operation.
transferOperationResult.Check();
}

Any ideas?

Thanks!!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24994
Location: Prague, Czechia
Can you download the files using WinSCP GUI or any other FTP client?
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License