WebClient and Thread


using System;
using System.Net;
using System.Threading;

class ThreadTest
{
    static void Main()
    {
        new Thread(Download).Start();
        Console.WriteLine("I'm still here while the download's happening!"); 
        Console.ReadLine();
    }

    static void Download()
    {
        WebClient wc = new WebClient();
        try
        {
            wc.Proxy = null;
            wc.DownloadFile("http://www.yourDomain", "your.html"); 
            Console.WriteLine("Finished!");
        }
        catch (Exception ex)
        {
            // Process exception...
        }
    }
}
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.