0 votes
by (150 points)

hello, i developed some code for file upload through sftp using the rebex library. it makes use of a proxy. but now some old code (without proxy), using FtpWebRequest, does not work anymore! the error returned is: requested ftp command is not supported using http proxy. how can i get it working again? thanks, Joost.

1 Answer

0 votes
by (147k points)
Best answer


Although Rebex SFTP's Proxy object is based on System.Net.WebProxy, it only utilizes some of its methods and does not modify application's or system's proxy settings. However, since it inherits from WebProxy, it can be used with .NET's WebRequest and assigned to its Proxy property.

And this seems to be what happened - you might have an instance of Rebex.Net.Proxy for use with Rebex SFTP, but proxy types provided by Rebex.Net.Proxy are not supported by .NET's FtpWebRequest object (although some of them might be supported by the related HttpWebRequest object).

If the old code using FtpWebRequest is supposed to work without proxy, plese make sure you are not making the Rebex Proxy object application-wide by assigning it to System.Net.GlobalProxySelection.Select (for example). Or, to make sure FtpWebRequests is not using any proxy, set it's Proxy property to null.

Alternatively, if you are developing an applicaiton that should support both SFTP and FTP, consider using Rebex File Transfer Packs's universal FTP client that makes it possible to target both FTP and SFTP using a single code base. Additionally, our FTP client does support HTTP CONNECT proxies.