Topic "connect with VB.net using FTP and SSL/TLS Implicit encryptio"

Author Message
Donpa
[View user's profile]

Joined: 2012-05-11
Posts: 1
I can connect to a site using the GUI interface but having trouble connecting using vb.net. My issue appears to be in my inablility to figure out how to include SSL/TLS Implicit encryption in the code. I am using the code below which was taken from a sample found on this site. The log tells me the site is valid but it does not have the correct associated data.
Has anyone succefully used this protocol/Encryption combination?

Code:

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
[/code]
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
Use SessionOptions.FtpSecure
https://winscp.net/eng/docs/library_sessionoptions
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License