Xceed FTP Library Documentation
FTP Client sample application for ASP
Sample applications > FTP Client sample application for ASP

Introduction

The ASP version of the FTP Client sample application demonstrates how to connect to an FTP server and obtain a directory listing via ASP code running VBScript. The sample also includes an HTML page that posts actions to the ASP page so you can visually connect and navigate through files and directories on an FTP server.

This sample uses the Microsoft IIS web server for running the ASP code, and a web browser for viewing the HTML page.

Users of the trial version must install the free trial package of the Xceed FTP Library on the system running IIS, so that the component is licensed for trial use as well as being registered as a useable COM object.

Registered users must uncomment the License method call in the FTPCLIENT.ASP file and provide their license key as the string parameter. Registered users of the Xceed FTP Library can use this sample application, or portions of it, in their own commercial or private applications, royalty-free.

Source code location

SAMPLES\ASP\FTPClient\FTPCLIENT.HTML\

How to use

The ASP FTP Client sample application contains two files. Both the FTPCLIENT.ASP and the FTPCLIENT.HTML files must be placed in wwwroot folder or other suitable folder on the system where your IIS web server is running.

Once you have placed the files, just point your browser to the HTML file in order to use the sample.

How it works

All the HTML page really does is allow you to enter an FTP server address and port as well as a username and password, and then does a <FORM ACTION="FTPCLIENT.ASP"> with the entered information passed to the ASP page as form fields.

When the ASP page is executed, it simply checks the information passed in the form fields (including a field named 'folder' that the HTML page did not fill provide), connects to the specified FTP server and obtains a folder listing. The directory listing starts at the FTP server's root folder because the HTML page did not specify the starting folder.

Once the ASP page has connected to the FTP server and obtained the directory listing, it generates a new HTML page on the fly containing a listing of the files and folders as well as their dates and sizes. If you click on a folder, the HTML page will call the ASP page again with the folder field set to the clicked-on folder, and a new HTML page will be regenerated containing the contents of the new folder. If you click on a file the HTML page will attempt to fetch it using the browser's built-in ftp download function.