File upload using SSL fails
Posted: Wed Sep 08, 2021 12:41 pm
Hi all
We have a number of WingFTP servers, on Windows, and we have a routine which transfers files via FTP. This is done using .NET C# application, and the code is below:
FtpWebRequest loFTPWeb;
try
{
//string folder from file name
string lsAbsFile = Path.GetFileName(psFileName);
if (psFolder != "")
//file needs to go into a subfolder on the ftp server
lsAbsFile = psFolder + lsAbsFile;
loFTPWeb = WebRequest.Create(new Uri(string.Format(@"ftp://{0}/{1}", psServer + ":" + psPort, lsAbsFile))) as FtpWebRequest;
loFTPWeb.Method = WebRequestMethods.Ftp.UploadFile;
loFTPWeb.UseBinary = true;
loFTPWeb.UsePassive = true;
loFTPWeb.KeepAlive = true;
loFTPWeb.Credentials = new NetworkCredential(psUsername, AISCrypto.DecryptString(psPassword));
loFTPWeb.ConnectionGroupName = "group";
loFTPWeb.EnableSsl = true;
using (FileStream loStream = File.OpenRead(psFileName))
{
byte[] buffer = new byte[loStream.Length];
loStream.Read(buffer, 0, buffer.Length);
loStream.Close();
Stream loSendSteam = loFTPWeb.GetRequestStream();
loSendSteam.Write(buffer, 0, buffer.Length);
loSendSteam.Close();
loSendSteam.Flush();
}
This is working fine with our older system (6.3.3 or older), but our latest system is on version 6.4.9 or 6.6.1 it fails. The reported error is SYSTEM ERROR, which I know isn't helpful. If I set the EnableSSL option to False, it works to all FTP Servers.
I have gone through all settings on both a working server and none working server. I can't see any differences that stand out as relating to SSL connections. There is a valid certificate on these servers.
I am not allowed access to the firewall, and I am thinking this is more of a firewall port 22 issue. Am I right?
Anything else that I can look at?
Many thanks.
James
We have a number of WingFTP servers, on Windows, and we have a routine which transfers files via FTP. This is done using .NET C# application, and the code is below:
FtpWebRequest loFTPWeb;
try
{
//string folder from file name
string lsAbsFile = Path.GetFileName(psFileName);
if (psFolder != "")
//file needs to go into a subfolder on the ftp server
lsAbsFile = psFolder + lsAbsFile;
loFTPWeb = WebRequest.Create(new Uri(string.Format(@"ftp://{0}/{1}", psServer + ":" + psPort, lsAbsFile))) as FtpWebRequest;
loFTPWeb.Method = WebRequestMethods.Ftp.UploadFile;
loFTPWeb.UseBinary = true;
loFTPWeb.UsePassive = true;
loFTPWeb.KeepAlive = true;
loFTPWeb.Credentials = new NetworkCredential(psUsername, AISCrypto.DecryptString(psPassword));
loFTPWeb.ConnectionGroupName = "group";
loFTPWeb.EnableSsl = true;
using (FileStream loStream = File.OpenRead(psFileName))
{
byte[] buffer = new byte[loStream.Length];
loStream.Read(buffer, 0, buffer.Length);
loStream.Close();
Stream loSendSteam = loFTPWeb.GetRequestStream();
loSendSteam.Write(buffer, 0, buffer.Length);
loSendSteam.Close();
loSendSteam.Flush();
}
This is working fine with our older system (6.3.3 or older), but our latest system is on version 6.4.9 or 6.6.1 it fails. The reported error is SYSTEM ERROR, which I know isn't helpful. If I set the EnableSSL option to False, it works to all FTP Servers.
I have gone through all settings on both a working server and none working server. I can't see any differences that stand out as relating to SSL connections. There is a valid certificate on these servers.
I am not allowed access to the firewall, and I am thinking this is more of a firewall port 22 issue. Am I right?
Anything else that I can look at?
Many thanks.
James