Free FTP Library

C#Ftp

C# Problem Overview


Can you recommend a free FTP library(class) for C#.

The class has to be well written, and have good performance.

C# Solutions


Solution 1 - C#

You may consider FluentFTP, previously known as System.Net.FtpClient.

It is released under The MIT License and available on NuGet (FluentFTP).

Solution 2 - C#

Why don't you use the libraries that come with the .NET framework: http://msdn.microsoft.com/en-us/library/ms229718.aspx?

EDIT: 2019 April by https://stackoverflow.com/users/1527/ This answer is no longer valid. Other answers are endorsed by Microsoft.

They were designed by Microsoft who no longer recommend that they should be used:

>We don't recommend that you use the FtpWebRequest class for new development. For more information and alternatives to FtpWebRequest, see WebRequest shouldn't be used on GitHub. (https://docs.microsoft.com/en-us/dotnet/api/system.net.ftpwebrequest?view=netframework-4.7.2)

The 'WebRequest shouldn't be used' page in turn points to this question as the definitive list of libraries!

Solution 3 - C#

edtFTPnet is a free, fast, open source FTP library for .NET, written in C#.

Solution 4 - C#

I like Alex FTPS Client which is written by a Microsoft MVP name Alex Pilotti. It's a C# library you can use in Console apps, Windows Forms, PowerShell, ASP.NET (in any .NET language). If you have a multithreaded app you will have to configure the library to run syncronously, but overall a good client that will most likely get you what you need.

Solution 5 - C#

Solution 6 - C#

I've just posted an article that presents both an FTP client class and an FTP user control.

They are simple and aren't very fast, but are very easy to use and all source code is included. Just drop the user control onto a form to allow users to navigate FTP directories from your application.

Solution 7 - C#

After lots of investigation in the same issue I found this one to be extremely convenient: https://github.com/flagbug/FlagFtp

For example (try doing this with the standard .net "library" - it will be a real pain) -> Recursively retreving all files on the FTP server:

  public IEnumerable<FtpFileInfo> GetFiles(string server, string user, string password)
    {
        var credentials = new NetworkCredential(user, password);
        var baseUri = new Uri("ftp://" + server + "/");

        var files = new List<FtpFileInfo>();
        AddFilesFromSubdirectory(files, baseUri, credentials);

        return files;
    }

    private void AddFilesFromSubdirectory(List<FtpFileInfo> files, Uri uri, NetworkCredential credentials)
    {
        var client = new FtpClient(credentials);
        var lookedUpFiles = client.GetFiles(uri);
        files.AddRange(lookedUpFiles);

        foreach (var subDirectory in client.GetDirectories(uri))
        {
            AddFilesFromSubdirectory(files, subDirectory.Uri, credentials);
        }
    }

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRobinView Question on Stackoverflow
Solution 1 - C#Erwin MayerView Answer on Stackoverflow
Solution 2 - C#0fntView Answer on Stackoverflow
Solution 3 - C#Bruce BlackshawView Answer on Stackoverflow
Solution 4 - C#John CView Answer on Stackoverflow
Solution 5 - C#KaneView Answer on Stackoverflow
Solution 6 - C#Jonathan WoodView Answer on Stackoverflow
Solution 7 - C#StephanView Answer on Stackoverflow