TotalBytesToReceive always -1

Hey, Ive been messing around with downloading files and right now Im working on a progress bar. Obviously I need to know the total amount of bytes, but it seems that e.TotalBytesToReceive always returns 0. The e.BytesReceived returns correctly, and its only that after the whole file is done downloading, the TotalBytesToRecieve returns correctly.
The total amount of bytes is: 16,666,843

The snippet Ive been using to check the values is:

Console.WriteLine("Bytes: " + e.BytesReceived + " of " + e.TotalBytesToReceive); 

by banana_shavings via /r/csharp

Leave a Reply