C
C#2y ago
nithilas

❔ Fluent FTP Problem

Currently writing a little C# program to connect to FTP server and download some files. Connecting to the server is no problem but as soon as i try to retrieve folders, files etc. I get a error
Code: 450 Message: TLS session of data connection has not resumed or the session does not match the control connection
My code is as follows:
using var conn = new FtpClient("host", "login", "pw", port);
conn.Config.EncryptionMode = FtpEncryptionMode.Explicit;
conn.Config.ValidateAnyCertificate = true;
conn.Config.SslProtocols = SslProtocols.Tls12;
conn.Connect();

foreach (var item in conn.GetListing("/", FtpListOption.Recursive))
{
switch (item.Type)
{

case FtpObjectType.Directory:

Console.WriteLine("Directory! " + item.FullName);
Console.WriteLine("Modified date: " + conn.GetModifiedTime(item.FullName));

break;

case FtpObjectType.File:

Console.WriteLine("File! " + item.FullName);
Console.WriteLine("File size: " + conn.GetFileSize(item.FullName));
Console.WriteLine("Modified date: " + conn.GetModifiedTime(item.FullName));
Console.WriteLine("Chmod: " + conn.GetChmod(item.FullName));

break;

case FtpObjectType.Link:
break;
}
}

using var conn = new FtpClient("host", "login", "pw", port);
conn.Config.EncryptionMode = FtpEncryptionMode.Explicit;
conn.Config.ValidateAnyCertificate = true;
conn.Config.SslProtocols = SslProtocols.Tls12;
conn.Connect();

foreach (var item in conn.GetListing("/", FtpListOption.Recursive))
{
switch (item.Type)
{

case FtpObjectType.Directory:

Console.WriteLine("Directory! " + item.FullName);
Console.WriteLine("Modified date: " + conn.GetModifiedTime(item.FullName));

break;

case FtpObjectType.File:

Console.WriteLine("File! " + item.FullName);
Console.WriteLine("File size: " + conn.GetFileSize(item.FullName));
Console.WriteLine("Modified date: " + conn.GetModifiedTime(item.FullName));
Console.WriteLine("Chmod: " + conn.GetChmod(item.FullName));

break;

case FtpObjectType.Link:
break;
}
}

Any tips or suggestions?
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server