dot net process is succesfull but file is not getting copied to destination (no error)
We are trying to copy the file from local system to SFTP site. Process is successful but file is not reaching destination location.
Here is the code:
try
{
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = XYZ //Testsftpsite.com
UserName = XYZ
Password = XYZ
PortNumber = XYZ
SshHostKeyFingerprint = XYZ
};
'ALL XYZ are replaced with actual values
using (Session session = new Session())
{
session.Open(sessionOptions);
bool blConnectionStatus = session.Opened;
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
transferOptions.FilePermissions = null;
transferOptions.PreserveTimestamp = false;
transferOptions.ResumeSupport.State = TransferResumeSupportState.Off;
TransferOperationResult transferResult;
transferResult = session.PutFiles(LOCALFilePath,RemoteFilePath,false,transferOptions);
transferResult.Check();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
Using WinSCP 5.7.4.0 on Windows 8 / 64 bit system.
Please help us to resolve the issue
Thanks
Here is the code:
try
{
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = XYZ //Testsftpsite.com
UserName = XYZ
Password = XYZ
PortNumber = XYZ
SshHostKeyFingerprint = XYZ
};
'ALL XYZ are replaced with actual values
using (Session session = new Session())
{
session.Open(sessionOptions);
bool blConnectionStatus = session.Opened;
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
transferOptions.FilePermissions = null;
transferOptions.PreserveTimestamp = false;
transferOptions.ResumeSupport.State = TransferResumeSupportState.Off;
TransferOperationResult transferResult;
transferResult = session.PutFiles(LOCALFilePath,RemoteFilePath,false,transferOptions);
transferResult.Check();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
Using WinSCP 5.7.4.0 on Windows 8 / 64 bit system.
Please help us to resolve the issue
Thanks