Connection a un SFTP

Advertisement

thierry.bertholom
Guest

Connection a un SFTP

Bonjour
Je découvre votre application.

J'essaye de l'intégrer à un développement sous VB.NET en utilisant vos exemple de connexions.
Protected Sub WinScpSFTPupload(ByVal fileToBeUploaded As String, uploadedFilename As String)
    Try
        Dim sessionOptions As New SessionOptions
        With sessionOptions
            .Protocol = Protocol.Sftp
            .HostName = C_Parametre.AdresseIPSSH
            .PortNumber = C_Parametre.PortSSH
            .UserName = C_Parametre.UtilisateurSSH
            .SshPrivateKey = "D:\CLIENTS\2024\ADSL\PrivateKeyAgicap.ppk" 'C_Parametre.ClePriveSSH
        End With
        Using session As New Session
            session.Open(sessionOptions)
            session.PutFiles(fileToBeUploaded, uploadedFilename).Check()
        End Using
    Catch ex As Exception
        MsgBox(ex.Message & Chr(13) & Chr(10) & uploadedFilename)
    End Try
End Sub ' Sub to WinSCP SFTP File
voici le message d'erreur

Merci de votre réponse
Thierry.bertholom

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,440
Location:
Prague, Czechia

Re: Connection a un SFTP

I believe the message is pretty clear.
Use the same version of WinSCPnet.dll and WinSCP.exe.
Ideally, do not rely on the installed version of WinSCP. Deploy a compatible copy of WinSCP.exe to the same folder, where you deploy the WinSCPnet.dll.

Reply with quote

Advertisement

You can post new topics in this forum