Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: FTPS error: Operation not permitted

Can you download the files using WinSCP GUI or any other FTP client?
jgorodriguez

FTPS error: Operation not permitted

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!!