<%@ Page Language="C#" %>
<%@ Import Namespace=System.IO %>
<%@ Import Namespace=System.Net %>

<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        Uri uri = new Uri("ftp://ftp.microsoft.com/SoftLib/ReadMe.txt ");
        if (uri.Scheme == Uri.UriSchemeFtp)
        {
            FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(uri);
            request.Method = WebRequestMethods.Ftp.DownloadFile;
            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
            StreamReader reader = new StreamReader(response.GetResponseStream());
            string tmp = reader.ReadToEnd();
            response.Close();

            //this.Panel1.GroupingText = tmp;
            this.ftpContent.InnerText = tmp;
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Using FTP from an ASP.NET webpage</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div runat="server" id="ftpContent" 
            style="overflow:scroll; height: 260px; width: 450px;">
        </div>
    </div>
    </form>
</body>
</html>
