Problems with .NET SFTP connection

Advertisement

Phil Gameson
Joined:
Posts:
2
Location:
Birmingham, United Kingdom

Problems with .NET SFTP connection

Hi,

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 1.0.0.528 of WINSCP.dll.


The C# code I am using is something like:

Session sctpSession = new Session();
try
{
// 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
};

// Connect
// session.DisableVersionCheck = true; // Not recommended!
sctpSession.Open(sessionOptions);

Reply with quote

Advertisement

Phil Gameson
Joined:
Posts:
2
Location:
Birmingham, United Kingdom

I am new to SFTP and am unsure how to use / get putty - as far as I can see this is not part of WINSCP itself.
Seeing that I can login to a particular SFTP using GUI without specifying a host key I feel that it must be possible to do the same using .NET. [However, looking at the documention, I am not so sure!]

From the documentation it looks like what I actually need is a fingerprint for the Ssh Host Key.

Reply with quote

Advertisement

You can post new topics in this forum