Thanks for the response Martin,
In a server when I'm trying to connect FTP box with WINScp client, I'm able to connect and get and put files. But on the same server when I'm trying to put files using WINSCP .net assembly, I'm getting connection timed out the issue.
I thought like it may be the firewall which blocks but in that scenario, I should not connect to FTP box with WINSCP client also.
Could you please let me know what could be the problem?
for your reference.
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,
Rahul.