Error getting name of current remote directory when trying to get files using c#
Hi
I'm trying to get files on remote host using c#.
I keep getting the following error message.
Attached log file.
my code looks like this:
SessionOptions so = new SessionOptions();
so.Protocol = Protocol.Scp;
so.HostName = txtHost.Text;
so.UserName = txtUsername.Text;
so.Password = txtPassword.Text;
so.SshHostKeyFingerprint = "ssh-rsa 1040 4b:51:f4:5e:64:63:70:0b:cf:97:d4:cd:4c:d9:c6:4e";
using (Session session = new Session())
{
// Connect
session.SessionLogPath = "c:\\Roei\\log.txt";
session.Open(so);
MessageBox.Show("session opened!!!");
var dirInfo = session.ListDirectory("/home/");
session.Close();
MessageBox.Show(dirInfo.Files.Count.ToString());
}
Thanks
Roei
I'm trying to get files on remote host using c#.
I keep getting the following error message.
Attached log file.
my code looks like this:
SessionOptions so = new SessionOptions();
so.Protocol = Protocol.Scp;
so.HostName = txtHost.Text;
so.UserName = txtUsername.Text;
so.Password = txtPassword.Text;
so.SshHostKeyFingerprint = "ssh-rsa 1040 4b:51:f4:5e:64:63:70:0b:cf:97:d4:cd:4c:d9:c6:4e";
using (Session session = new Session())
{
// Connect
session.SessionLogPath = "c:\\Roei\\log.txt";
session.Open(so);
MessageBox.Show("session opened!!!");
var dirInfo = session.ListDirectory("/home/");
session.Close();
MessageBox.Show(dirInfo.Files.Count.ToString());
}
Thanks
Roei