Using FTP

For simple FTP upload and download operations, you can use WebClient as we did previously:


using System;
using System.Net;
using System.Threading;
using System.IO;
using System.Text;
class ThreadTest
{
    static void Main()
    {
        WebClient wc = new WebClient();
        wc.Proxy = null;
        wc.Credentials = new NetworkCredential("nutshell", "yourValue");
        wc.BaseAddress = "ftp://ftp.abc.com";
        wc.UploadString("tempfile.txt", "hello!");
        Console.WriteLine(wc.DownloadString("tempfile.txt")); // hello!

    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.