Error in session.open(MySessionOption)

Advertisement

acandela
Joined:
Posts:
1

Error in session.open(MySessionOption)

Hello
I'm using WinSCP in an application .net c# whit winscp.dll library(the code below), but when i go to execute the "session.open(MySessionOption)", i get the error message "System.IO.FileNotFoundException".
Can you tell me where is the mistake?
Thanks



SessionOptions MySessionOption = new SessionOptions
{
Protocol = Protocol.Ftp,
HostName = "server.com",
UserName = "user",
Password = "password",
SshHostKey = "ssh-rsa 1024 ab:3e:c1:b0:49:d0:f0:99:83:8f:ca:f9:cb:2f:24:35",
PortNumber=22
};

using (Session session = new Session())
{
// Connect
session.ExecutablePath = @"C:\Programm\WinSCP\WinSCP.exe";
session.DisableVersionCheck = true;
session.Open(MySessionOption);

// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;

TransferOperationResult transferResult;
transferResult = session.PutFiles(@"test.txt", "/upload/test.txt", false, transferOptions);

// Throw on any error
transferResult.Check();

}

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum