Questions re System.IO.FileStream

  • Thread starter Thread starter musosdev
  • Start date Start date
M

musosdev

Hi guys

I'm trying to code up a file downloading system for our website (C#).

My basic plan is that when a user clicks a file download, a page opens that
shows something, and fires the chunked file download (via FileStream).

That wroks fine, but what I want is a situation where if window that started
the download is closed, the streaming stops. IE the download stops.

Currently, I'm using the C# code from this KB article..
http://support.microsoft.com/kb/812406 - as I say, the download fires ok.

The question is, how do I stop it before it finshes?! Is it even possible,
or am I gonna have to do it in Silverlight?!

Thanks,


Dan
 
you will need to do a server push solution. on the main window, using a
hidden iframe, hit a page, that pushes data to the client (unbuffered and
flush()), that can detect a closed connection. it should also poll for the
download status from the download page so it knowns when to close. if the
connection is closed then it can notify the download page. the download page
must also use unbuffered output so it can stop.

one last detail is that only one of the pages can use session (as the
requests to the same session are queued).

-- bruce (sqlwork.com)
 
Back
Top