Re: issue with provided public key
Please post the actual error message.
protected void UploadViaWINSCP()
{
var sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = ConfigurationManager.AppSettings["Host"],
UserName = ConfigurationManager.AppSettings["username"],
Password = ConfigurationManager.AppSettings["password"],
SshHostKeyFingerprint = "ssh-rsa 1024 xx:xx:xx:xx etc",
PortNumber = 22
};
var localfilename = @"~/DataStore/" + ViewState["FileName"];
var remotefilename = Path.GetFileName(localfilename);
using (var session = new Session())
{
session.DisableVersionCheck = true;
session.Open(sessionOptions); //gets here and crashes
TransferOptions transfer = new TransferOptions();
transfer.TransferMode = TransferMode.Binary;
TransferOperationResult transferrResult;
transferrResult = session.PutFiles(localfilename, remotefilename, false, transfer);
transferrResult.Check();
}
}