Post a reply :: Support Forum

Tip: Styles can be applied quickly to selected text.

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

vbinohio

ExplicitTls...

Hello,
Does anyone have an example on how to connect using SessionOptions and ExplicitTLS? I get a connection failed when I do this:

using WinSCP;
.
.
.
public static List<FtpDirectoryListing> GetFiles()
{
try
{
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Ftp,
HostName = ConfigurationManager.AppSettings["FTP"],
UserName = ConfigurationManager.AppSettings["User"],
Password = ConfigurationManager.AppSettings["Password"],
SslCertificate = "xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xxx:xx:xx:xx:xx:xx:xx:xx",
FtpSecure = FtpSecure.ExplicitTls
};

Console.WriteLine("HostName: " + sessionOptions.HostName);
Console.WriteLine("Password: " + sessionOptions.Password);
Console.WriteLine("UserName: " + sessionOptions.UserName);
Console.WriteLine("FTPSecure: " + FtpSecure.ExplicitTls);
Console.WriteLine("SSLCertificate: " + sessionOptions.SslCertificate);

using (Session session = new Session())
{
//connect in
session.Open(sessionOptions)
.
.
.

Thank you in advance,
Vince


***************************************************************************************
Of course as soon as I post this, I figured it out. This does work, but the problem was with the naming convention of the host name, this went from a web services connection to having to use winscp, the older name was ftp://ftp.someplace.us. I renamed it to ftp.someplace.us. I found the correct certificate by running the WinSCP client with the correct parameters and going to commands=>Server/protocol information after connection was established.

Vince