Closed Thread
Results 1 to 6 of 6

Thread: Easy way to download a file

  1. #1
    Saint is offline Learning Programmer
    Join Date
    Aug 2006
    Posts
    63
    Rep Power
    0

    Easy way to download a file

    Is there an easy way to download a file using .NET 2.0??? I know I saw something a long time ago that had a very simple downloader, just two lines long - any one know how to do it???
    Hi >> Saint

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22
    System.Net.WebClient I think is what you're looking for.

  4. #3
    Jordan Guest
    Yes, this is very easy to use to download. Here is C# code to download a file:

    Code:
    System.Net.WebClient Client = new System.Net.WebClient();
    Client.DownloadFile("http://www.url.com/file.ext", string.Concat("C:\file\path", "filename"));
    This is untested but converted code to C++ 2.0 should look like:

    Code:
    System::Net::WebClient Client = new System::Net::WebClient();
    Client->DownloadFile("http://url", string.Concat("c:\path", "filename"));

  5. #4
    Void's Avatar
    Void is offline Programming Expert
    Join Date
    Jun 2006
    Posts
    410
    Rep Power
    23
    The code you posted Jordan works in VC++ .NET 2.0. I've actually used this before to download small ascii based files only - anyone ever used it for something large? Is there a way to get a progress of download?
    Void

  6. #5
    RobSoftware is offline Programmer
    Join Date
    Nov 2005
    Posts
    143
    Rep Power
    0
    To get progess you would probably have to write your own library that uses sockets to connect and download.

  7. #6
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22
    There's a System.Net.Web.WebClient.DownloadProgressChanged event that you can use for large(ish) async downloads.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. HTTP Getting Browser To Open File And Not Download File
    By RhetoricalRuvim in forum General Programming
    Replies: 6
    Last Post: 08-05-2011, 12:14 AM
  2. Download file blocker
    By oneplace2u in forum PHP Development
    Replies: 3
    Last Post: 10-16-2010, 10:55 PM
  3. PHP Download File Stream
    By chinz85 in forum PHP Development
    Replies: 1
    Last Post: 06-04-2010, 02:07 AM
  4. unable to download file from php
    By vsr in forum PHP Development
    Replies: 6
    Last Post: 02-09-2010, 03:00 AM
  5. Download a file
    By Lop in forum PHP Development
    Replies: 14
    Last Post: 05-16-2008, 10:07 AM

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