Re: need C# source code - for connect SFTP server without password option
So, can you connect in WinSCP GUI? Did my link help?
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = Dts.Variables["HostName"].Value.ToString(),
UserName = Dts.Variables["UserNameSFTP"].Value.ToString(),
PortNumber = Convert.ToInt32(Dts.Variables["PortNumber"].Value),
SshHostKeyFingerprint = "ssh-rsa ################",
SshPrivateKeyPath = "D:\\WinsSCPkey\\Win_Private4.PPK",
};
using (Session session = new Session())
{
session.ExecutablePath = Dts.Variables["WinscpExecutable"].Value.ToString();
session.Open(sessionOptions);
}