Lost Password?

  #1 (permalink)  
Old 09-06-2006, 04:54 PM
Saint Saint is offline
Learning Programmer
 
Join Date: Aug 2006
Posts: 63
Rep Power: 8
Saint is on a distinguished road
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 09-06-2006, 06:23 PM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 10
brackett is on a distinguished road
Default

System.Net.WebClient I think is what you're looking for.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-07-2006, 07:06 PM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Age: 26
Posts: 5,857
Last Blog:
Performance or Maintai...
Rep Power: 20
Jordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud of
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

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"));
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
Don't hesitate to ask any questions that you have! Check out our ASCII Calculator!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-09-2006, 12:33 PM
Void's Avatar   
Void Void is offline
Programming Expert
 
Join Date: Jun 2006
Posts: 410
Rep Power: 11
Void is on a distinguished road
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-11-2006, 01:42 PM
RobSoftware RobSoftware is offline
Programmer
 
Join Date: Nov 2005
Posts: 143
Rep Power: 11
RobSoftware is on a distinguished road
Default

To get progess you would probably have to write your own library that uses sockets to connect and download.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 09-11-2006, 02:13 PM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 10
brackett is on a distinguished road
Default

There's a System.Net.Web.WebClient.DownloadProgressChanged event that you can use for large(ish) async downloads.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows XP Tricks & Tips!!!!..new ones. pranky Tutorials 9 08-23-2008 03:22 PM
Project: ionFiles - Joomla Simple File Download Jordan Community Projects 300 08-13-2008 08:36 PM
Download a file Lop PHP Forum 14 05-16-2008 12:07 PM
Project: ionFiles - Joomla Simple File Download - Mirror 2 Jordan ionFiles 3 04-07-2008 03:09 PM
How do I let people download a file from my page? littlefranciscan HTML Programming 6 01-28-2007 11:57 PM


All times are GMT -5. The time now is 03:26 PM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 65%

Ads