Questions re System.IO.FileStream

Questions re System.IO.FileStream

am 24.01.2008 17:20:01 von musoswire

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

RE: Questions re System.IO.FileStream

am 24.01.2008 17:28:03 von pbromberg

Try using the Response.IsClientConnected property.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com


"musosdev" wrote:

> 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

RE: Questions re System.IO.FileStream

am 24.01.2008 17:45:02 von brucebarker

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)


"musosdev" wrote:

> 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