I know that I can download a file from a web server by using the
WebClient.DownloadFile method. But, does anyone know of an example of
downloading a file from a web server with the ability to monitor the
download progress?
I'm looking for either the number of bytes downloaded and/or percentage
completed.
TIA 4 3851
"Richard L Rosenheim" <ri*****@rlr.com> schrieb: But, does anyone know of an example of downloading a file from a web server with the ability to monitor the download progress?
<URL:http://groups.google.de/groups?q=dotnet+download+file+progress>
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Thanks, I found a Compact Framework example that looks promising. I should
be able to utilize the code, after possibly a little conversion.
Richard
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O0**************@TK2MSFTNGP09.phx.gbl... "Richard L Rosenheim" <ri*****@rlr.com> schrieb: But, does anyone know of an example of downloading a file from a web server with the ability to monitor the download progress?
<URL:http://groups.google.de/groups?q=dotnet+download+file+progress>
-- Herfried K. Wagner [MVP] <URL:http://dotnet.mvps.org/>
Hi,
Here is a quick example. Add these import statements.
Imports System.Net
Imports System.IO
Sample code
Dim request As WebRequest
Dim response As WebResponse
Dim reader As Stream
Dim writer As Stream
Dim data(1023) As Byte
Dim count As Integer
Dim total As Integer
Me.Show()
Me.Text = "Downloading file ....."
Application.DoEvents()
request =
WebRequest.Create("http://www.onteorasoftware.com/downloads/multigrids.zip")
response = request.GetResponse()
reader = response.GetResponseStream()
ProgressBar1.Maximum = CInt(response.ContentLength)
ProgressBar1.Value = 0
total = 0
writer = File.Create("mylocaldata.zip")
While True
count = reader.Read(data, 0, 1024)
If count <= 0 Then
Exit While
End If
writer.Write(data, 0, count)
total += 1024
If total < ProgressBar1.Maximum Then ProgressBar1.Value = total
Application.DoEvents()
End While
reader.Close()
writer.Close()
Ken
--------------------------
"Richard L Rosenheim" <ri*****@rlr.com> wrote in message
news:uv**************@TK2MSFTNGP14.phx.gbl...
I know that I can download a file from a web server by using the
WebClient.DownloadFile method. But, does anyone know of an example of
downloading a file from a web server with the ability to monitor the
download progress?
I'm looking for either the number of bytes downloaded and/or percentage
completed.
TIA
Thanks.
Richard
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ui****************@TK2MSFTNGP14.phx.gbl... Hi,
Here is a quick example. Add these import statements.
Imports System.Net
Imports System.IO Sample code Dim request As WebRequest
Dim response As WebResponse
Dim reader As Stream
Dim writer As Stream
Dim data(1023) As Byte
Dim count As Integer
Dim total As Integer
Me.Show()
Me.Text = "Downloading file ....."
Application.DoEvents()
request =
WebRequest.Create("http://www.onteorasoftware.com/downloads/multigrids.zip") response = request.GetResponse()
reader = response.GetResponseStream()
ProgressBar1.Maximum = CInt(response.ContentLength)
ProgressBar1.Value = 0
total = 0
writer = File.Create("mylocaldata.zip")
While True
count = reader.Read(data, 0, 1024)
If count <= 0 Then
Exit While
End If
writer.Write(data, 0, count)
total += 1024
If total < ProgressBar1.Maximum Then ProgressBar1.Value = total
Application.DoEvents()
End While
reader.Close()
writer.Close() Ken
--------------------------
"Richard L Rosenheim" <ri*****@rlr.com> wrote in message news:uv**************@TK2MSFTNGP14.phx.gbl... I know that I can download a file from a web server by using the WebClient.DownloadFile method. But, does anyone know of an example of downloading a file from a web server with the ability to monitor the download progress?
I'm looking for either the number of bytes downloaded and/or percentage completed.
TIA This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ASP Spam Fighter |
last post by:
Hello all,
I don't know how to get around this one... If anybody can help me
with this problem, I would appreciate it very much.
I've been trying to send a (large) file to the browser via a...
|
by: Shawn |
last post by:
Hi.
How can I download a file and store it on the web server. I have a complete
URL to the file, but I never know what kind of file it is. It can be pdf,
jpg, tif, doc, xls etc.
Thanks,
Shawn
|
by: Joe |
last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located.
When trying to add a web reference to a C# project I get an error message
'There was an error downloading...
|
by: just.starting |
last post by:
Hi,
My dot net client downloads files and checks for any new files time to
time. The server is apache2.0.53 server. So what happens is that my
file download thing works fine if I dont try to call...
|
by: just.starting |
last post by:
Hi,
My dot net client downloads files and checks for any new files time to
time. The server is apache2.0.53 server. So what happens is that my
file download thing works fine if I dont try to call...
|
by: Tomas Martinez |
last post by:
Hi there!
I'm trying to download a file in my asp.net web, but when downloading it
from a Firefox browser, instead of downloading the example.exe file, it's
downloading example.exe.htm. My code...
|
by: rony_16 |
last post by:
Hi,
I have a problem downloading a file .
after i connect to the website and get the stream , i treing to write
the file on the HD.
public void SaveStreamToFile(string filePath, Stream stream)
{...
|
by: keerthyragavendran |
last post by:
hi
i'm downloading a single file using multiple threads...
how can i specify a particular range of bytes alone from a single
large file... for example say if i need only bytes ranging from...
|
by: Muddasir |
last post by:
Hello everyone.
I am facing problem in downloading .xls file.
I generate report and save data in excel sheet on server. and once user click the 'save data in excel format', an excel sheet is...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |