ExplicitTls...

Advertisement

vbinohio
Joined:
Posts:
1
Location:
Work

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

Reply with quote

Advertisement

You can post new topics in this forum