Put Files not working in Amazon AWS server.
Getting session log out and put files not working in Amazon AWS server. But, its working fine in Local.
I am using 5.9.6 version.
Below is my code
SessionOptions sessionOptions = new SessionOptions
{
Protocol = WinSCP.Protocol.Sftp,
HostName = "sftp.XXXXXX.com",
PortNumber = 22,
UserName = "XXXXXXXXX",
Password = "XXXXXXXXXX",
SshHostKeyFingerprint = "XXX-XXa 1098 xx:xx:xx:xx:xxx:xxx:xx:xx:xx:",
};
using (Session session = new Session())
{
// Connect
session.Open(sessionOptions);
// Your code
}
session.DebugLogPath = Server.MapPath("Temp/") + "logWinSCP";
session.Open(sessionOptions);
// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
TransferOperationResult transferResult = null;
transferResult = session.PutFiles(Server.MapPath("Temp/" + _fileName), "/users/adminTest/sample/", false, transferOptions);
// Throw on any error
transferResult.Check();
Thanks,
Ram