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