I am trying to put the zip file from my system to sftp server using the following code.
Most of the information like sftpusername , sftppassword etc are self-explanatory. In case any information is required feel free to ask
But it is failing more often then not I am using WinSCP version 5.9.2 (build 6958). I am using the code below in C#.
The issue occurs when the WinSCP is not able to connect in 15 seconds. After that when it tries to it takes dir, ls as inputs for username and password rather than sftpusername and sftppassword.
//Console.WriteLine("Password: ----->" + sftppassword);
// winscp.StandardInput.WriteLine("-hostkey=" +hostkey);
// Creating directories if not already present
winscp.StandardInput.WriteLine("mkdir " + path);
// Traversing to the required directory
winscp.StandardInput.WriteLine("cd " + path);
//Putting the zip file onto the server
winscp.StandardInput.WriteLine("put " + zippath);
string output = winscp.StandardOutput.ReadToEnd();
// completly shutting down the process
The attach log has the issue captured.
Is there a possibility to make it more robust and user-friendly.
Let me know in case any further details or information is required.
Thanks in Advance