Download Silverlight: is it safe?

I have seen the Silverlight download example here , which is mentioned several times on this site and elsewhere, but I have a question about whether it is really safe.

Short review: this code “loads” the download into the ASHX handler. UploadFileChunk () creates an instance of WebClient and uses OpenWriteAsync and OpenWriteCompletedEventHandler to send some bits from the file. WebClient communicates with the handler using a URI with two QueryString parameters: "filename" and "append". After writing the bits in the fragment to the WebClient output stream, the event handler checks to see if all bits have been sent, and if it does not yet call UploadFileChunk () to send another fragment.

On the server side, the handler is simple - write a bit to disk using FileStream, adding if append = 1 and re-creating if append = 0.

This architecture is likely to cause problems. Is the server guaranteed to shut down with writing bits and closing the feed filter before it receives the next request and starts adding bits from the next fragment? My understanding of OpenWriteCompletedEventHandler on the Silverlight side is that when you finish the write operation and close the stream, it does not necessarily mean that the bits were sent along the entire channel, not to mention the processing by the server-side handler.

Thank!

+3
source share
1 answer

( ), Silverlight Open Source

+1

Source: https://habr.com/ru/post/1745840/


All Articles