winscp .NET assembly open sftp session with out Hostkey

Advertisement

Sasidharan9513
Joined:
Posts:
11

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

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum