Send file to browser via form submission then redirect in classic ASP

Kineris

New Member
I'm currently working on a project where a user will select a bunch of options, hit submit and then the page that handles the submission will create a bunch of comma-delimited files, zip them up and send them back to the client.I have most of this working just fine except for one part. The page where the user selects a bunch of options then calls via form submission an ASP page that handles all the file creation stuff. When the user hits submit, I show a progress bar so they know the page is working.The problem I'm running into is that if I put a \[code\]Response.Redirect\[/code\] at the end of my script, the file doesn't get sent to the browser. If I don't put a \[code\]Response.Redirect\[/code\] at the end of the script, the calling page doesn't get reloaded and just sits there like its still working.I've tried doing this with jQuery and AJAX but that doesn't work either.Some code...The criteria selection page\[code\]<form method="post" action="../../scripts/generate-presentation-data.asp" onsubmit="return submitform();">...form items...</form><script>function submitform(){if ( confirm('Generate presentation data?') ){ return true; }else { return false; }}</script>\[/code\]And the called page:\[code\]Response.Buffer = True...create files, zip them up etc...Response.AddHeader "Content-Disposition", "attachment;filename=" & Chr(34) & "board-presentation-data.zip" & Chr(34)Set objStream = Server.CreateObject("ADODB.Stream")objStream.OpenobjStream.Type = 1objStream.LoadFromFile(sFilePath & "board-presentation-data.zip")Response.BinaryWrite(objStream.Read)\[/code\]If I put a redirect at the end of this, the file never gets sent to the browser.Any ideas how I can get something like this to work properly?Thanks.
 
Back
Top