Topic "Problems with .NET SFTP connection"

Author Message
Phil Gameson
[View user's profile]

Joined: 2012-05-29
Posts: 2
Location: Birmingham, United Kingdom
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);
Advertisements
Guest




I had this same issue and I believe that I used putty to get my host key.
Phil Gameson
[View user's profile]

Joined: 2012-05-29
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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
I have added topic to the FAQ:
https://winscp.net/eng/docs/faq_hostkey
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License