Topic "Error in session.open(MySessionOption)"

Author Message
acandela
[View user's profile]

Joined: 2012-07-01
Posts: 1
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();

}
VaskezNS
[View user's profile]

Joined: 2012-07-01
Posts: 2
Location: Novi Sad, Serbia
Im not sure but have you tried specifying full path to your file instead of @"test.txt" ?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Please set Session.DebugLogPath and post or email me the log.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License