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

martin
Site Admin
martin avatar
Joined:
Posts:
32,391
Location:
Prague, Czechia

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

What does it mean "without a password option"? Do you want to use a public key authentication?

Anyway, if you can connect in WinSCP GUI, it can generate a C# code template for you:
https://winscp.net/eng/docs/ui_generateurl#code

Reply with quote

Guest

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

martin wrote:

What does it mean "without a password option"? Do you want to use a public key authentication?

Anyway, if you can connect in WinSCP GUI, it can generate a C# code template for you:
https://winscp.net/eng/docs/ui_generateurl#code

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