Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Flush problem

Status
Not open for further replies.

jimmythegeek

Programmer
May 26, 2000
770
US
I have a dowload page that is called from another page. On the dowload page, I get the file I need to download, and download it (which works great). At the end of the code, I need to redirect back to my calling page, but it is not working. I assume it's because of the response.flush.

If I take the flush out, the download doesn't work at all. It works the same using response.end. Is it possible to redirect after a flush?

I've tried using server.transfer, putting javascript with location.replace, and the such, but to no avail. I would greatly appreciate any assistance I could get on this. Thanks in advance

===============

... Get file code ...

with response
.Buffer = True
.Clear
.AddHeader "Content-Disposition", "attachment; filename=" & f.name
.AddHeader "Content-Length", intFilelength
.CharSet = "UTF-8"
.ContentType = "application/octet-stream"
.BinaryWrite s.Read
.Flush
.redirect
end with
===============

Also, if I put any code (html, javascript, etc) after this, it gets written into any text file I download, and thoughts on that?

This whole file upload/download thing is a pain and I have not done it before.

Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
if you've been response.flush 'ing to the client so they can see progress or whatever, then response.redirecting of course you're going to need response.buffer=true before any page output, and secondly, use a response.clear to clear the output buffer, response.end to stop sending, and response.redirect to send to the other page, without clearing or ending it you'll get an error denoting that HTML headers have been sent and you can not perform the requested operation.

hope the info helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top