Re: connect with VB.net using FTP and SSL/TLS Implicit encryptio
Use SessionOptions.FtpSecure
https://winscp.net/eng/docs/library_sessionoptions
https://winscp.net/eng/docs/library_sessionoptions
Imports System
Imports WinSCP
Module Module1
Sub main()
Send_Doc()
End Sub
Public Function Send_Doc() As Boolean
Try
' Setup session options
Dim sessionOptions As New SessionOptions
With sessionOptions
.Protocol = Protocol.Ftp
.PortNumber = 990
.HostName = Parm_Destination
.UserName = Parm_User
.Password = Parm_PWord
End With
Using session As Session = New Session
' Connect
session.SessionLogPath = "c:\WinSCP_Send_File.log"
session.Open(sessionOptions)
' Upload files
Dim transferOptions As New TransferOptions
transferOptions.TransferMode = TransferMode.Binary
Dim transferResult As TransferOperationResult
' local SFTP site
transferResult = session.PutFiles(SendDoc, Parm_Destination, False, transferOptions)
' Throw on any error
transferResult.Check()
' Print results
Dim transfer As TransferEventArgs
For Each transfer In transferResult.Transfers
Console.WriteLine("Upload of {0} succeeded", transfer.FileName)
Next
End Using
Return True
Catch e As Exception
Console.WriteLine("Error: {0}", e)
Return False
End Try
End Function
End Module