I am trying to upload a file or data stream to our web server, and I cannot find a decent way to do this. I tried both WebClient and WebRequest , both have their problems.
Webclient
Pleasant and easy, but you do not receive notification of the completion of the asynchronous download, and the UploadProgressChanged event UploadProgressChanged not receive a callback with anything useful. An alternative is to convert your binary data to a string and use UploadStringASync , because then, at least you get UploadStringCompleted , the problem is that you need a lot of ram for large files, since it encodes all the data and downloads it all at once.
HttpWebRequest
The bit is more complex, but still doing what it needs, the problem I get is that although it is called a background thread (presumably), it still seems to block my user interface and the entire browser while loading will not end, which does not seem quite right.
Normal .net has some suitable WebClient methods for OnUploadDataCompleted and progress, but these arent available at Silverlight.net .. A big omission, I think!
Does anyone have any solutions, I need to download some binary files with success, but I need to perform some actions when the files have finished downloading.
Look forward to help with this.
source share