need C# source code - for connect SFTP server without password option
need C# source code - for connecting SFTP server without a password option.
Anyone having a solution. please assist me
I am using the following code. Please see and correct me.
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);
}
Thanks,
Anuj
Anyone having a solution. please assist me
I am using the following code. Please see and correct me.
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);
}
Thanks,
Anuj