Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Phil Gameson

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.
Guest

Re: Problems with .NET SFTP connection

I had this same issue and I believe that I used putty to get my host key.
Phil Gameson

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);