We'll request an instance of the FtpWebRequest class and then use its methods to view directory information about our listening FTP server. The instance will be pointing to ftp://localhost, which, as I mentioned, defaults to port 21 without actually specifying it, thanks to the ftp:// schema. Just as HTTP has methods for interacting with the server, FTP has its own methods for determining how it intends to interact with the server. In code, that is set with a series of static constant properties that are used by the FtpWebRequest class to determine how to initiate the desired behavior:
static async Task<string> GetDirectoryListing() { StringBuilder strBuilder = new StringBuilder(); FtpWebRequest req = (FtpWebRequest)WebRequest.Create("ftp://localhost"); ...