I am trying to connect to an SFTP site for which I have been given a user id and password, but not an ssh host key.
Whilst I can connect successfully using the WINSCP front end, if I try connecting via the .NET assembly I either get a message telling me I need to supply a host key, or if I supply an null or empty ("") key I get "Host key wasn't verified".
Do I need to set another option if I am not providing an ssh host key?
I am using version 5.07.2268 WINSCP.exe and 18.104.22.1688 of WINSCP.dll.
The C# code I am using is something like:
Session sctpSession = new Session();
// Setup session options
SessionOptions sessionOptions = new SessionOptions
Protocol = (useSftp ? Protocol.Sftp : Protocol.Ftp),
HostName = ftpSite,
UserName = userName,
Password = password
,SshHostKey = "" // Tried commenting this out, but just got different error
// session.DisableVersionCheck = true; // Not recommended!