Status-Progress Bar for file download and upload to web server

G

Gary O'Malley

Everytime I download a file from the web I get a nice animated
dialogue box that shows the size of the file, how much has been
received and the approximate remaining time. It also gives the
connection bandwidth.
I've looked in different development groups through google/groups to
find an example of C # code that would give me a similar readout.
The closest I've come is my local web developer says the Internet
Explorer is the application that does that and somehow I have to
connect into Internet Explorer to get this dialogue box.
I just want to show the user the progress of either their data upload
or the progress of their data download. I know the size of the zip
file they are loading for the upload, I don't know the size of the
file for the download.

Any suggestions would be appreciated.
I've also looked in the .NET documentation. For something so common,
it sure is hard to find. I'm stuck.
 
N

Nicholas Paldino [.NET/C# MVP]

Gary,

When Internet Explorer does this, it depends on a few things. First,
when downloading, it might not know the size of the content that it is
downloading. In this case, it makes a guess as to what the max size is, and
then works from that (at least for the progress bar on IE, for the dialog,
it doesn't show a progress bar).

Now, as far as I know, there isn't a way to show that dialog yourself.
So, to do this, you will have to create your own. You should look at the
ContentLength property to see if there is a length associated with the
download. If there is, then you can use that to determine the max value of
your progress bar. Otherwise, you will have to make a best guess based on
other factors.

Hope this helps.
 
J

Jerry Negrelli

"Everytime I download a file from the web I get a nice
animated dialogue box that shows the size of the file,
how much has been received and the approximate remaining
time. It also gives the connection bandwidth."

Yes, this is definitely IE's doing and nothing that web
developers are writing themselves. Are you trying to
mimic this feature in a windows application or your own
web app?

JER
 
G

Gary O'Malley

Jerry Negrelli said:
"Everytime I download a file from the web I get a nice
animated dialogue box that shows the size of the file,
how much has been received and the approximate remaining
time. It also gives the connection bandwidth."

Yes, this is definitely IE's doing and nothing that web
developers are writing themselves. Are you trying to
mimic this feature in a windows application or your own
web app?

JER

Thanks for the post to Jerry and Nicholas.
Yes, this is a desktop/laptop C# application that syncs data from a
central datastore (SQL2000) using Web Services to upload a compressed
XML file with XML Schema info included. Zip file contains changed
records and new records from last upload date in xml format.
The user also downloads using a criteria of last download date and if
the record has changed since the last download.
That aside, I want to give the users in the field a pop up form,
similar to the one we all see when downloading files from the web.
Form should show file size, what has been uploaded both numeric and
progress bar format, and download speed that is occuring.
The question is, when using web services in C# what information can I
get
on what is happening during data transfer?
Are there any hooks in Web Services that I can use to either display
this information directly or is there information I can 'listen' to to
derive the information I want to display?(equations etc.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top