TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bharat Bhammar
NA
1
803
I Need To Send File On Server Using SFTP, But It Is Not Work
Mar 1 2016 5:10 AM
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);
}
}
return 0;
}
catch (Exception e)
{
Console.WriteLine("Error: {0}", e);
return 1;
}
}
Reply
Answers (
1
)
MVC4 Razor( How To get a specific value from database
Select different page for different user.