DouglasDwyer.ExtensibleFtp 1.0.1

.NET Core 3.1
dotnet add package DouglasDwyer.ExtensibleFtp --version 1.0.1
NuGet\Install-Package DouglasDwyer.ExtensibleFtp -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DouglasDwyer.ExtensibleFtp" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DouglasDwyer.ExtensibleFtp --version 1.0.1
#r "nuget: DouglasDwyer.ExtensibleFtp, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DouglasDwyer.ExtensibleFtp as a Cake Addin
#addin nuget:?package=DouglasDwyer.ExtensibleFtp&version=1.0.1

// Install DouglasDwyer.ExtensibleFtp as a Cake Tool
#tool nuget:?package=DouglasDwyer.ExtensibleFtp&version=1.0.1

Nuget Downloads


ExtensibleFtp provides a customizable, scalable FTP server implementation in .NET. It comes with a default implementation for anonymous FTP access, and allows for easy addition of new commands, abstract filesystems, and user identities/login schemes.

Referencing ExtensibleFtp

ExtensibleFtp is available as a Nuget package called DouglasDwyer.ExtensibleFtp for inclusion in any .NET project. To include it in your project, either download it using the package manager GUI in Visual Studio, or run the command Install-Package DouglasDwyer.ExtensibleFtp from the Nuget package manager console.

Basic concepts

ExtensibleFtp servers are separated into several classes in order to allow for scalability and easy reconfiguration. The ExtensibleFtpServer class listens for new FTP connections while managing currently connected clients. It contains a list of FtpCommand, which are objects that represent unique actions the user can commit over FTP. The behavior of FTP commands such as USER or PASV is defined by inheriting the FtpCommand abstract class. In addition, the server object contains an IFtpAuthenticator object, which is in charge of managing user accounts. The authenticator is used to implement login behavior (such as checking for a username and password in a database), and generating IFtpIdentity instances, which represent unique user identities and may be used to define various user permissions. In turn, IFtpIdentity objects expose an IFtpFilesystem interface, which is an abstraction over a user filesystem. Custom IFtpFilesystem implementations allow for much flexibility and creativity - files/folders can be hidden, restricted, or even "fabricated" without really existing on the host machine. A complete API reference may be found here.

Getting started

Creating a new server

Starting a new FTP server using C# is as simple as two lines of code! After referencing DouglasDwyer.ExtensibleFtp, one can instantiate FTP servers like this:

ExtensibleFtpServer server = new ExtensibleFtpServer(new AnonymousAuthenticator("C:/Some/Path/"));

This code creates a new server coupled with an AnonymousAuthenticator, an authenticator that allows any connected users access to the specified directory and all of its contents. server.Start() causes the server to begin listening (on port 21 by default).

Adding a custom FTP command

A number of standard FTP commands are included in the ExtensibleFtp implementation. If the need arises to create a new/custom command, though, the implementation is simple - just override the FtpCommand interface and specify the custom behavior. The code for the DELE command is given below:

public class DeleCommand : FtpCommand
    public override string CommandName => "DELE";

    public override void Execute(ExtensibleFtpUser user, string path)
        path = Path.Combine(user.CurrentDirectory, path);
            user.SendResponse(FtpStatusCode.FileActionOK, "File deleted successfully.");
            throw new FtpException(FtpStatusCode.ActionNotTakenFileUnavailable, "File does not exist.");

Instances of the ExtensibleFtpUser class are used to interact with clients. It is separate from IFtpIdentity - the user class allows for actions like sending and receiving FTP messages, whereas an identity identifies a user. Anyhow, to use a custom command with a server, it can either be passed into the ExtensibleFtpServer constructor along with all other commands that the server should use, or it can be added to the ExtensibleFtpServer.DefaultCommandSet list. Any servers instantiated without a specified command set after the command is added to the list will recognize it.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 313 8/28/2021 470 7/16/2020 436 7/16/2020
1.0.0 383 7/8/2020