Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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

So, can you connect in WinSCP GUI? Did my link help?
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.
martin

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
anuj

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