Topic "All steps OK but not getting the files in .net"

Author Message
[View user's profile]

Joined: 2015-11-23
Posts: 1
Location: New Jersey
I have a task to do SFTP in a .net program. Everything is fine except that we are not getting back the files. In Debugging am not getting any errors in the steps but problem is no files coming back. in the manual SCP, we have to copy paste the files that come back, we wanted to automate this.


<add key="HostName" value="" />
<add key="UserName" value="Groups" />
<add key="Password" value="mypassword" />
<add key="SshHostKeyFingerprint" value="ssh-rsa 2047 za:5z:z6:77:36:d6:94:89:44:15:b0:ca:59:bf:d3:92" />
<add key="LocalPath" value="\\server-app01\cust\SC\AMAZON\WINSCP\TESTAMAZON" />
<!-- this is local folder path -->
<add key="RemotePath" value="/outgoing/orders/AMAZON/" />
<!-- this is remote system directory path -->
<add key="ClientSettingsProvider.ServiceUri" value="" />
Program.cs try { // Setup session options SessionOptions sessionOptions = new SessionOptions {

//Passing HostName , Password, & UserName here. port number
Protocol = Protocol.Sftp,
HostName = ConfigurationManager.AppSettings["HostName"].ToString(),
UserName = ConfigurationManager.AppSettings["UserName"].ToString(),
Password = ConfigurationManager.AppSettings["Password"].ToString(),
SshHostKeyFingerprint = ConfigurationManager.AppSettings["SshHostKeyFingerprint"].ToString()
string LocalPath = ConfigurationManager.AppSettings["LocalPath"].ToString();
string RemotePath = ConfigurationManager.AppSettings["RemotePath"].ToString();

using (Session session = new Session())
// Connect

// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;

TransferOperationResult transferResult;
transferResult = session.PutFiles(LocalPath + "*", RemotePath, false, transferOptions);

// Throw on any error
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26889
Location: Prague, Czechia
Your duplicate post on Stack Overflow:

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License