C sharp asp net anyone create a library to talk to edgecast cdn via ftp


ASP.NET is a popular programming language used for web applications. It provides a framework for dynamic , web services, and web applications. In this article, we will explore how to create a library to talk to CDN via FTP ASP.NET.

Setting up the Project

To , let's create a new ASP.NET project in Visual Studio. Open Visual Studio and select “Create a new project.” Choose the ASP.NET Web template and provide a name for your project. Click “OK” to create the project.

Adding the FTP Library

Next, we need to add the FTP library to our project. You can either download the library from the official website or use a package manager like NuGet to install it. For this example, let's assume we are using the NuGet package manager.

Install-Package System.Net.FtpClient

Connecting to Edgecast CDN via FTP

Once the library is added to our project, we can start writing code to connect to Edgecast CDN via FTP. , we need to import the necessary namespaces:

using System;
using System.Net;
using System.Net.FtpClient;

Next, we can create a method to establish a connection to the Edgecast CDN FTP server:

public static FtpClient ConnectToFtpServer(string server, string username, string password)
    FtpClient client = new FtpClient();
    client.Host = server;
    client. = new NetworkCredential(username, password);
    return client;

In the above code, we create a new instance of the FtpClient class and set the server, username, and password. We then establish a connection to the FTP server using the Connect() method and return the client object.

Uploading a File to Edgecast CDN

Now that we have established a connection to the Edgecast CDN FTP server, let's see how we can upload a file to it. We can create a method like this:

public static void UploadFileToFtpServer(FtpClient client, string localFilePath, string remoteFilePath)
    using (var fileStream = File.OpenRead(localFilePath))
        client.Upload(fileStream, remoteFilePath);

In the above code, we open the local file using the File.OpenRead() method and pass it to the Upload() method of the FtpClient object along with the remote file path. This will upload the file to the Edgecast CDN FTP server.


In this article, we have explored how to create a library to talk to Edgecast CDN via FTP using ASP.NET. We learned how to set up the project, add the FTP library, establish a connection to the FTP server, and upload a file to the server. This knowledge can be to various scenarios where interacting with Edgecast CDN via FTP is required in an ASP.NET application.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents