I tried both separately and each fixed the problem. Thanks for the help.
- htony
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
Session.ListDirectory
before the Session.PutFiles
? It seems there's some problem with the first data connection, possibly due to TLS session reuse.
session.ListDirectory("/some/path")
SslSessionReuse
to "0"
:
sessionOptions.AddRawSettings("SslSessionReuse", "0")
WinSCPnet.dll
installed in the GAC. Below is the VB.NET code and I have attached two log files, one created via code and one created via the GUI.
Try
Dim sessionOptions As New SessionOptions
With sessionOptions
.Protocol = Protocol.Ftp
.HostName = "hostName"
.UserName = "UserName"
.Password = "Password"
.FtpSecure = FtpSecure.Implicit
.TlsHostCertificateFingerprint = "FP"
End With
Using session As New Session
session.SessionLogPath = "log.txt"
session.DebugLogLevel = 2
session.ExecutablePath = "C:\Program Files (x86)\WinSCP\WinSCP.exe"
' Connect
session.Open(sessionOptions)
' Download files
Dim transferOptions As New TransferOptions
transferOptions.TransferMode = TransferMode.Binary
transferOptions.ResumeSupport.State = TransferResumeSupportState.On
Dim transferResult As TransferOperationResult = Nothing
transferResult = session.PutFiles()
' Throw on any error
If transferResult IsNot Nothing Then transferResult.Check()
End Using
Catch ex As Exception
MsgBox(ex.ToString)
End Try