Post a reply

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

Donpa

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

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?

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]