Topic "SCP Protocol Failing with Blank Password (.NET)"

Author Message
[View user's profile]

Joined: 2016-06-14
Posts: 3
Using WinSCPnet.dll and WinSCP.exe version
.NET 4.5

SessionOptions sessionOptions = new SessionOptions();
sessionOptions.Protocol = Protocol.Scp;
sessionOptions.HostName = mtpAddress; //IP Address
sessionOptions.UserName = "root";
sessionOptions.Password = "";
sessionOptions.PortNumber = 22;
sessionOptions.GiveUpSecurityAndAcceptAnySshHostKey = true;

using (Session session = new Session())
    session.Open(sessionOptions); //<------------------------------------------FAILS HERE

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

    TransferOperationResult transferResult;
    transferResult = session.GetFiles(sourceFilePath, destinationFilePath, removeSource, transferOptions);

    // Throw on any error

I get the following error message:
An unhandled exception of type 'WinSCP.SessionRemoteException' occurred in WinSCPnet.dll

Additional information: Connection has been unexpectedly closed. Server sent command exit status 0.

Things to note:
    The same credentials work with the WinSCP.exe GUI
    I'm using SCP, not SFTP
    Password is blank (""). Have also tried null with the same result.

Any help would be greatly appreciated. Thank you!
[View user's profile]

Joined: 2016-06-14
Posts: 3
Adding log from WinSCPnet.dll
DotNetLog.txt (26.31 KB) Private file

Description: The log from WinSCPnet.dll

[View user's profile]

Joined: 2016-06-14
Posts: 3
Adding log from successful WinSCP.exe GUI connection
WinSCPGUILog.log (20.3 KB) Private file

Description: Log from successful WinSCP.exe GUI connection

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24759
Location: Prague, Czechia
Thanks for your report.

This issue has been added to the tracker:

You can post new topics in this forum

Search Site

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