I can define a proxy server using the WinSCP GUI. If I do this, I can connect to the remote host. But in the code, I did not find a way to declare a proxy server for WinSCP.
In this case, I get
The remote server returned an error (407) Proxy authentication required.
My code is:
SessionOptions sessionOptions = new SessionOptions { Protocol = protocol, HostName = hostname, UserName = user, Password = pass, PortNumber = portnumber }; using (Session session = new Session()) { session.ExecutablePath = @"C:\Program Files (x86)\WinSCP\WinSCP.exe"; session.Open(sessionOptions); TransferOptions options = new TransferOptions(); options.FileMask = mask; SynchronizationResult synchronizationResult; synchronizationResult = session.SynchronizeDirectories(mode, local, path, deletefiles, options: options); synchronizationResult.Check(); }
deyaert
source share