Click here to Skip to main content
15,888,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
I Need To Send File On Server Using SFTP, But It Is Not Work.
 
I have Use WinSCP And Get Error "Network error: Software caused connection abort"
 
my code is below
 
public static int Main()
{
try
{
// Setup session options
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "",
UserName = "",
Password = "",
GiveUpSecurityAndAcceptAnySshHostKey = true,
//SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
};

using (Session session = new Session())
{
// Connect
session.Open(sessionOptions);

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

TransferOperationResult transferResult;
//String filePath = Server.MapPath("Templates/3-FinancialAdvisor.pdf");
transferResult = session.PutFiles(@"C:\Users\keenans", "../Bin/WinSCP.exe", false, transferOptions);

// Throw on any error
transferResult.Check();

// Print results
foreach (TransferEventArgs transfer in transferResult.Transfers)
{
Console.WriteLine("Upload of {0} succeeded", transfer.FileName);
}
}


What I have tried:

i have Try To It Given All SFTP Client To Connect, But Any One Not Access This Credential Without Filezilla.
FileZilla
WinSCP
WS_ftp
FireFTP
Posted
Updated 29-Feb-16 23:53pm

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900