I wonder how do I check how much of a file has been uploaded/downloaded? I am using HttpWebRequest
views:
43answers:
2
A:
You have to call it asynchronously to update the progress of your upload/download.
HttpWebRequest have methods like
public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state);
public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state);
accepting asynchronous callbacks.
Cheers
Ramesh Vel
2010-10-13 14:20:53
downvote?? what for???
Ramesh Vel
2010-10-13 14:22:59
Thank you but can you elaborate abit on how you would do this.
jiewmeng
2010-10-14 12:19:40
+1
A:
You can do this is you use async mode on the HttpWebRequest
- there is a working sample (based on the MSDN doc sample code) here. Brief description:
Here’s a little Win Forms client that allows you to download a single file from a server, using either HTTP or FTP. It shows download progress and displays the average transfer rate, in kb/sec. It also demonstrates how to use the HttpWebRequest and FtpWebRequest classes in System.Net to do file downloads.
Steve Townsend
2010-10-13 14:23:43