It works with winscp client but not with .net assembly
Issue which I'm facing is, using hostname, userID and password it opens a folder but I have to navigate to virtual path which contains some positioning parameters in it. so how can I do the same? any suggestions or help? I saw some options to change directory but this is not an option in .net
sessionOptions = new SessionOptions
Protocol = Protocol.Ftp,
FtpSecure = FtpSecure.Explicit,
HostName = HostName,
PortNumber = 21,
UserName = userName,
Password = Password,
TlsHostCertificateFingerprint = (string)Dts.Variables ["User::SshHostKeyFingerprintEDS"].Value,
FtpMode = FtpMode.Passive,
using (Session session = new Session())
session.ExecutablePath = @"C:\Program Files (x86)\WinSCP\WinSCP.exe";
string _localPath = @"LocalPath" + providerCode + @"\*";
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
transferOptions.FilePermissions = null; // This is default
transferOptions.PreserveTimestamp = false;
transferResult = session.PutFiles(_localPath, "/abc/xxx/yyy/", false, transferOptions);
Here I'm getting error and error message is:
Error transferring file LocalPath_along_with_file_name.
Real path and requested remote path do not match: "/abc" ReceiverId: "xxx" FileName: "yyy" RefNo: "TCPIP/" "/acb/ReceiverID/FileName/"
Copying files to remote side failed.