2

I am using VSTS 2008 + C# + .Net 3.5 to develop a console application to upload a file to server. For the WebClient.UploadProgressChanged Event, I am wondering what is the rule when this event will be raised? I read the below document but find no accurate information (like will be raised 10 times during upload or something). Does anyone know what is the rule when this event will be raised?

http://msdn.microsoft.com/en-us/library/system.net.webclient.uploadprogresschanged.aspx

1 Answer 1

1

No, I don't think there is any specific rule. How many times event is called is mostly dependent on how large is the file you are uploading and how fast is your connection.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, can I understand the event will be raised randomly -- i.e. even if I use the same client upload the same file to the same server, the times of event raised may be different?
Yes. Msdn says 'This event is raised each time an asynchronous upload makes progress.' so for small files it might very well be similar almost every time, but you must assume its random at all time (ie. don't base any logic on how many times it will be raised).
If I am rely on the event to implement a progress bar, do you think it should be fine? I do not want the event to be raised too few times (0% and 100%), and I also do not wnat the event to be raised too often (e.g. raise each time 0.1% of the whole file is uploaded). Any comments?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.