+ Reply to Thread
Results 1 to 2 of 2

Thread: Download a file from a URL

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    10

    Download a file from a URL

    I'd like to know how to download files from the web , can you tell me about the method ?
    Last edited by matrix; 11-08-2012 at 11:29 PM.

  2. #2
    Junior Member
    Join Date
    Feb 2012
    Posts
    19
    To download file you have to create a WebClient object and use the method DownloadFile and give it a file url and file name and it willl
    fetch and download it , so here is the code i am using :
    Code:
            public void DownloadFile(string File_URL, string File_Name)
            {
                try
                {
                    System.Net.WebClient WebClient = new System.Net.WebClient();
                    // Downloads the resource with the specified URI to a local file.
                    WebClient.DownloadFile(File_URL, File_Name);
    
                }
                catch (Exception ee)
                {
                    // Error
                    Console.WriteLine("Failed to download file because of error: {0}", ee.ToString());
                }
            }

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts