Bypassing proxy

Advertisement

csurfleet
Guest

Bypassing proxy

I'm trying to synch a folder using the winscp automation stuff but I need to bypass the network proxy. Here is my current code:
Process winscp = new Process();
winscp.StartInfo.FileName = winScpLocation;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();

winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open ftp://" + ftpUserName + ":" + ftpPassword + "@" + ftpSite + " -passive=off");
winscp.StandardInput.WriteLine("put " + appOfflinePath);
winscp.StandardInput.WriteLine("exit");

winscp.StandardInput.Close();

winscp.WaitForExit();

This works fine when transferring to an internal FTP server but not when going external to the network. In FileZilla I would just select the 'bypass proxy' checkbox and all is well but the code above just hangs indefinately.

Any help would be amazing!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: Bypassing proxy

Afaik, Bypass proxy in Filezilla just disables using globally set proxy for that particular session. WinSCP does not have global proxy settings. It has per-session proxy settings only. So you just do not set proxy instead. So you code should work as is.

Anyway, I recommend you use WinSCP .NET assembly instead.
https://winscp.net/eng/docs/library

Reply with quote

csurfleet
Guest

Hmm weird. I'll have a go with the .net assembly instead, it seems there is definitely some connection setting issue though as it works fine to internal FTP but not externally :?

Reply with quote

Advertisement

You can post new topics in this forum