That was cool .. I got that error because of the Path for key was wrong .. now fine ..
thanks for the help martin :) ..
Finally it started working ..
thanks for the help martin :) ..
Finally it started working ..
* 2015-05-29 14:50:00.293 Host key fingerprint is ssh-rsa 2048 d4:3f:c0:a4:e6:e2:7a:76:48:5a:3e:96:0d:56:c3:a9.
* 2015-05-29 14:50:00.293 (Exception) **Host key does not match configured key "ssh-rsa 1024 03:cc:d2:da:68:06:b7:29:01:fc:b9:1c:4f:c8:2e:ac"!**
SessionOptions.SshHostKeyFingerprint
, but the key is "ssh-rsa 2048 d4:3f:c0:a4:e6:e2:7a:76:48:5a:3e:96:0d:56:c3:a9".
Please attach a full session log file showing the problem (using the latest version of WinSCP).
To generate log file, setSession.SessionLogPath
. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
Session.SessionLogPath
. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.Try
' Setup session options
Dim mySessionOptions As New SessionOptions
With mySessionOptions
.Protocol = Protocol.Sftp
.HostName = TxtHost.Text
.UserName = TxtUName.Text
.Password = TxtPwd.Text
.PortNumber = 22
.SshHostKeyFingerprint = TxtKey.Text
End With
LblInfo.Text = LblInfo.Text & "Assigned Session Options" & vbNewLine
Dim mySession As New Session
Using mySession
LblInfo.Text = LblInfo.Text & "Session declared " & vbNewLine
mySession.Open(mySessionOptions)
LblInfo.Text = LblInfo.Text & "Connected" & vbNewLine
Dim directory As RemoteDirectoryInfo = mySession.ListDirectory(TxtSource.Text)
LblInfo.Text = LblInfo.Text & "Setting Transfer Options " & vbNewLine
Dim fileInfo As RemoteFileInfo
LblInfo.Text = "-----------------------------------------------------"
For Each fileInfo In directory.Files
'Console.WriteLine("{0} with size {1}, permissions {2} and last modification at {3}", _
'fileInfo.Name, fileInfo.Length, fileInfo.FilePermissions, fileInfo.LastWriteTime)
LblInfo.Text = LblInfo.Text & fileInfo.Name.ToString & " with size " & fileInfo.Length.ToString & ", permissions " & fileInfo.FilePermissions.ToString & " and last modification at " & fileInfo.LastWriteTime.ToString & vbNewLine
'lblinfo.Text = "copied file : " & vbNewLine
Next
LblInfo.Text = "-----------------------------------------------------"
End Using