views:

181

answers:

2

I'm having an issue within my application Pelotonics. When a user downloads a file the system seems to block all incoming requests until that file is done downloading. What is the proper technique to to open a download dialog box (standard from the browser), let the user start downloading the file, then while the file is downloading, let the user continue throughout the application.

The way we're getting the file from the server is we have a separate ASPX page that get's passed in a value through the query string, then retrieves the stream of the file from the server, then I add the "content-disposition" header to the Response and then loop through the file's stream and read 2KB chunks out to the response.outputstream. Then once that's done I do a Response.End.

Watch this for a quick screencast on the issue:

http://www.screencast.com/users/PeloCast/folders/Jing/media/8bb4b1dd-ac66-4f84-a1a3-7fc64cd650c0

by the way, we're in ASP.NET and C#...

Thanks!!! Daniel

A: 

I think ASP.NET allows one simultaneous page execution per session and I'm not aware of any way to configure this otherwise.

This is not a very pretty workaround, but it might help if you rewrote ASP.NET_SESSIONID value to the request cookie in Application_BeginRequest (in global.asax). Of course, you would need to the authentication some other way. I haven't tried this, though.

Another way would be launching a separate thread for the download process, but you would need to find a way how this can be done without the worker thread closing it's resources.

May I ask, is there a reason why don't you just use HttpResponse.TransmitFile?

Skrim
No, Skrim, that was in classic ASP.
Andrei Rinea
which was in classic ASP?
Skrim
TransmitFile takes in a filename parameter. The file I'm getting resides on Rackspace's Cloud Files Servers. Thus I need to authenticate into their servers, get the file (as a Stream), and write that stream out to the Response.OutputStream.I pretty sure TransmitFile doesn't work like that...I found this but the MSDN article doesn't exactly answer the issue: http://forums.asp.net/t/1112997.aspx
A: 

I have this same issue in ASP.NET using TransmitFile() was there any other solution?

NFX