Topic "ArgumentNullException: Value cannot be null. Parameter name: path1"

Author Message


This is my code on c#

string server = ConfigurationManager.AppSettings["server"];
string user = ConfigurationManager.AppSettings["user"];
string password = ConfigurationManager.AppSettings["password"];
string pathToFolder = ConfigurationManager.AppSettings["pathToFolder"];
SessionOptions options = new SessionOptions();
options.HostName = server;
options.Password = password;
options.Protocol = Protocol.Scp;
options.Timeout = TimeSpan.FromSeconds(20);
options.UserName = user;
options.SshHostKeyFingerprint = ""; //I don't use security code
using (WinSCP.Session session = new WinSCP.Session())
// Connect

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

TransferOperationResult transferResult;
transferResult = session.PutFiles(@"d:\toupload\*", "/home/user/", false, transferOptions);

// Throw on any error

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

My application works on mono/linux and I don't use security code

Exception throws when I try to open session.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26711
Location: Prague, Czechia
Please attach a full exception callstack and full debug log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.DebugLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

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