System.Net.WebClient

Sc0pe

Member
Joined
Oct 15, 2004
Messages
24
When I use this code to download a file, the files are always at least 2 megabytes so the program "freezes" when you click on anything until the download is finished. Is there a way to make it work better? Its almost like its not responding until the download is finished...Anyway to fix this?

Code:
Dim wcClient As System.Net.WebClient = New System.Net.WebClient

wcClient.DownloadFile("www.yoursite.com", "Filename.exe")
 
You may be better of using the HttpWebRequest class - either look at its async Begin / End GetRequestStream methods, or if you just want to display some indication of progress during a download look at clicky
 
PlausiblyDamp said:
You may be better of using the HttpWebRequest class - either look at its async Begin / End GetRequestStream methods, or if you just want to display some indication of progress during a download look at clicky

Ive tried that, the progressbar isnt even close to accurate...it finishes way before it should...Is it set to only work with small files?

Enclosed is the sample app that is in that link, the file I try to download is roughly 2 megabytes, the progressbar finishes in about 4 seconds and then the program hangs (unresponsive) for a while. Is there something that needs to be changed? Please check it out, the same url is still there from what I used.
 

Attachments

Last edited by a moderator:
Back
Top