Need C# source code – for connect SFTP server without password option

Advertisement

anuj
Joined:
Posts:
1
Location:
indore

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

Reply with quote

Advertisement

Guest

Re: need C# source code - for connect SFTP server without password option

Hi martin,

Yes, I need public key authentication.

Reply with quote

martin
Site Admin
martin avatar

Re: need C# source code - for connect SFTP server without password option

So, can you connect in WinSCP GUI? Did my link help?

Reply with quote

Advertisement

You can post new topics in this forum