<p>Anyone know of a good, hopefully free FTP class for use in .NET that can actually work behind an HTTP proxy or FTP gateway? The FtpWebRequest stuff in .NET is horrible at best, and I really don't want to roll my own here.</p>

[{'answer_id': 73566, 'author': 'Joel Coehoorn', 'author_id': 3043, 'author_profile': 'https://Stackoverflow.com/users/3043', 'pm_score': -1, 'selected': False, 'text': "<p>System.Net.WebClient can handle ftp urls, and it's a bit easier to work with.  You can set credentials and proxy information with it, too.</p>\n"}, {'answer_id': 73630, 'author': 'Jakub Šturc', 'author_id': 2361, 'author_profile': 'https://Stackoverflow.com/users/2361', 'pm_score': 1, 'selected': False, 'text': '<p>I have no particular experience but <a href="http://sharptoolbox.com/" rel="nofollow noreferrer">sharptoolbox</a> offer <a href="http://sharptoolbox.com/search?ToolName%253dftp%2526Description%253dftp%2526Category%253d9d0e4330-f6ff-4ead-afd3-f77f1c06cdc8%2526Attribute%253d-800" rel="nofollow noreferrer">plenty implementations</a>.</p>\n'}, {'answer_id': 73637, 'author': 'Juanma', 'author_id': 3730, 'author_profile': 'https://Stackoverflow.com/users/3730', 'pm_score': 1, 'selected': False, 'text': '<p>You can give <a href="http://www.indyproject.org/index.en.aspx" rel="nofollow noreferrer" title="Indy.Sockets">"Indy.Sockets"</a> a try. It can handle a lot of high level network protocols, including ftp.</p>\n'}, {'answer_id': 74165, 'author': 'Brad Bruce', 'author_id': 5008, 'author_profile': 'https://Stackoverflow.com/users/5008', 'pm_score': 1, 'selected': False, 'text': '<p>The best one I\'ve run across is edtFTP.net <a href="http://www.enterprisedt.com/products/edtftpnet/overview.html" rel="nofollow noreferrer">http://www.enterprisedt.com/products/edtftpnet/overview.html</a>  </p>\n\n<p>If offers flexibility you don\'t get in the built-in classes</p>\n'}, {'answer_id': 75069, 'author': 'Kearns', 'author_id': 6500, 'author_profile': 'https://Stackoverflow.com/users/6500', 'pm_score': 0, 'selected': False, 'text': '<p>I have used <a href="http://sourceforge.net/projects/dotnetftpclient/" rel="nofollow noreferrer">http://sourceforge.net/projects/dotnetftpclient/</a> for quite a while now, and it does the job nicely. If you use a PASV connection, you shouldn\'t have any firewall issues. Not sure what an FTP gateway is, but I don\'t see how the HTTP Proxy would affect any FTP connection.</p>\n'}, {'answer_id': 2327985, 'author': 'Martin Vobr', 'author_id': 16132, 'author_profile': 'https://Stackoverflow.com/users/16132', 'pm_score': 2, 'selected': False, 'text': '<p>Our <a href="http://www.rebex.net/ftp.net/" rel="nofollow noreferrer">Rebex FTP</a> works with proxies just fine. Following code shows how to connect to the FTP using HTTP proxy (code is taken from <a href="http://www.rebex.net/ftp.net/tutorial-ftp.aspx#proxy" rel="nofollow noreferrer">FTP tutorial page</a>).</p>\n\n<pre><code>// initialize FTP client \nFtp client = new Ftp();\n\n// setup proxy details  \nclient.Proxy.ProxyType = FtpProxyType.HttpConnect;\nclient.Proxy.Host = proxyHostname;\nclient.Proxy.Port = proxyPort;\n\n// add proxy username and password when needed \nclient.Proxy.UserName = proxyUsername;\nclient.Proxy.Password = proxyPassword;\n\n// connect, login \nclient.Connect(hostname, port);\nclient.Login(username, password);\n\n// do some work \n// ... \n\n// disconnect \nclient.Disconnect();\n</code></pre>\n\n<p>You can download the trial at <a href="http://www.rebex.net/ftp.net/download.aspx" rel="nofollow noreferrer">www.rebex.net/ftp.net/download.aspx</a></p>\n'}, {'answer_id': 2328113, 'author': 'Rush Frisby', 'author_id': 266804, 'author_profile': 'https://Stackoverflow.com/users/266804', 'pm_score': 0, 'selected': False, 'text': '<p>I used this in my project recently and it worked great.</p>\n\n<p><a href="http://www.codeproject.com/KB/IP/ftplib.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/IP/ftplib.aspxt</a></p>\n'}, {'answer_id': 8060892, 'author': 'Brady Moritz', 'author_id': 177242, 'author_profile': 'https://Stackoverflow.com/users/177242', 'pm_score': 0, 'selected': False, 'text': '<p>.Net 4.0+ now includes an ftp client class- see this msdn link for more info.  </p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx</a></p>\n\n<p>I see options for even using PASV mode etc, so it appears to be fully functional (or so I hope).  </p>\n'}, {'answer_id': 12266161, 'author': 'freggel', 'author_id': 49788, 'author_profile': 'https://Stackoverflow.com/users/49788', 'pm_score': 0, 'selected': False, 'text': '<p>I had a simalor issue, create an client for FTPS (explicit) communcation through a Socks4 proxy.</p>\n\n<p>After some searching and testing I found .NET library Starksoftftps.\n<a href="http://starksoftftps.codeplex.com/" rel="nofollow">http://starksoftftps.codeplex.com/</a></p>\n\n<p>Here is my code sample:</p>\n\n<pre><code>Socks4ProxyClient socks = new Socks4ProxyClient("socksproxyhost",1010);\nFtpClient ftp = new FtpClient("ftpshost",2010,FtpSecurityProtocol.Tls1Explicit);\nftp.Proxy = socks;\nftp.Open("userid", "******");\nftp.PutFile(@"C:\\519ec30a-ae15-4bd5-8bcd-94ef3ca49165.xml");\nConsole.WriteLine(ftp.GetDirListAsText());\nftp.Close();\n</code></pre>\n'}, {'answer_id': 20353970, 'author': "A. 'Eradicator' Polyakov", 'author_id': 3061817, 'author_profile': 'https://Stackoverflow.com/users/3061817', 'pm_score': 0, 'selected': False, 'text': '<p>Here is my open source C# code that uploads file to FTP via HTTP proxy.</p>\n\n<pre><code>public bool UploadFile(string localFilePath, string remoteDirectory)\n{\n    var fileName = Path.GetFileName(localFilePath);\n    string content;\n    using (var reader = new StreamReader(localFilePath))\n        content = reader.ReadToEnd();\n\n    var proxyAuthB64Str = Convert.ToBase64String(Encoding.ASCII.GetBytes(_proxyUserName + ":" + _proxyPassword));\n    var sendStr = "PUT ftp://" + _ftpLogin + ":" + _ftpPassword\n        + "@" + _ftpHost + remoteDirectory + fileName + " HTTP/1.1\\n"\n        + "Host: " + _ftpHost + "\\n"\n        + "User-Agent: Mozilla/4.0 (compatible; Eradicator; dotNetClient)\\n" + "Proxy-Authorization: Basic " + proxyAuthB64Str + "\\n"\n        + "Content-Type: application/octet-stream\\n"\n        + "Content-Length: " + content.Length + "\\n"\n        + "Connection: close\\n\\n" + content;\n\n    var sendBytes = Encoding.ASCII.GetBytes(sendStr);\n\n    using (var proxySocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))\n    {\n        proxySocket.Connect(_proxyHost, _proxyPort);\n        if (!proxySocket.Connected)\n            throw new SocketException();\n        proxySocket.Send(sendBytes);\n\n        const int recvSize = 65536;\n        var recvBytes = new byte[recvSize];\n        proxySocket.Receive(recvBytes, recvSize, SocketFlags.Partial);\n\n        var responseFirstLine = new string(Encoding.ASCII.GetChars(recvBytes)).Split("\\n".ToCharArray()).Take(1).ElementAt(0);\n        var httpResponseCode = Regex.Replace(responseFirstLine, @"HTTP/1\\.\\d (\\d+) (\\w+)", "$1");\n        var httpResponseDescription = Regex.Replace(responseFirstLine, @"HTTP/1\\.\\d (\\d+) (\\w+)", "$2");\n        return httpResponseCode.StartsWith("2");\n    }\n    return false;\n}\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/73544', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/91911/']