Unable to connect/synchronize using SFTP

Advertisement

DDPSC
Joined:
Posts:
1
Location:
St. Louis MO

Unable to connect/synchronize using SFTP

Hello,
We are able to connect using the WinSCP client using the same login credentials etc as used in the code below, but we get no errors reported nor does the file get uploaded when running the code. We are successfully using the same code to connect to a different server with no problems. Any help is much appreciated.


 Try
            ' Set up session options
            Dim sessionOptions2 As New SessionOptions
            With sessionOptions2
                .Protocol = Protocol.sftp
                .HostName = "xxx.zzz.com"
                .UserName = "user"
                .Password = "password"
                .SshHostKeyFingerprint = "ssh-ed25519 256 xxxxxxxxxxxxxxxxxxx="    
            End With

            sessionOptions2.AddRawSettings("FSProtocol", "2")

            Using session2 As New Session
                ' Connect                
                session2.Open(sessionOptions2)
              
                ' Upload files
                Dim transferOptions2 As New TransferOptions
                transferOptions2.TransferMode = WinSCP.TransferMode.Binary

                Dim sDate2 As String = DateTime.Now.AddDays(1).ToString("yyyyMMdd", System.Globalization.CultureInfo.GetCultureInfo("en-US"))
                Dim transferResult2 As TransferOperationResult
                transferResult2 = session2.PutFiles("e:\inetpub\wwwroot\iLabs\Imports\" & sDate2 & "_pi_funds.csv", "incoming/", False, transferOptions2)

                ' Throw on any error
                transferResult2.Check()
                
                ' Print results
                For Each transfer In transferResult2.Transfers
                    Response.Write(transfer.ToString())
                Next
            End Using
        Catch er As Exception
            Console.WriteLine("Error: {0}", er)
        End Try

Thank you

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
31,935
Location:
Prague, Czechia

Re: Unable to connect/synchronize using SFTP

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum