- martin
Post a reply
Topic review
- Sasidharan9513
winscp .NET assembly open sftp session with out Hostkey
Hi There,
I am getting the below error when I am open a session with out giving the Host key informtion.
"SessionOptions.Protocol is Protocol.Sftp , but SessionOptions.HostKey is not set."
Is is possible to open a sftp session with out giving a host key or host key is a must?
My Code :
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "example.com",
UserName = "username",
Password = "password"
};
using (Session session = new Session())
{
// Connect
session.DisableVersionCheck = false;
session.Open(sessionOptions); ---- get error in this line since I am not giving Host Key info
}
Regards,
S.Sasidharan
I am getting the below error when I am open a session with out giving the Host key informtion.
"SessionOptions.Protocol is Protocol.Sftp , but SessionOptions.HostKey is not set."
Is is possible to open a sftp session with out giving a host key or host key is a must?
My Code :
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "example.com",
UserName = "username",
Password = "password"
};
using (Session session = new Session())
{
// Connect
session.DisableVersionCheck = false;
session.Open(sessionOptions); ---- get error in this line since I am not giving Host Key info
}
Regards,
S.Sasidharan