469,322 Members | 1,626 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,322 developers. It's quick & easy.

Redirect after writing a file to the response?

Is there a way to achieve to following:
1) ASP page is loaded to client.
2) User submits form, requesting a file download
3) File is generated and written to response
4) User receives file, saves it and closes the dialogs.
5) ASP page redirects to another URL

I've tried many ways to accomplish this, both client and server side.
Client-side looks possible but with some complicated coding.
Server-side appears easier to manage, but my knowledge of ASP is limited - it looks impossible as the user cannot fully download the file until the repsonse ends, therefore the redirect cannot be transmitted; similarly sending the redirect first causes the file transmission to screw up client-side and the user is not prompted to save it.

Any ideas? I'm hoping that I'm missing something.
Oct 30 '07 #1
2 1363
3,406 Expert 2GB
... I'm hoping that I'm missing something.
NO, that sounds about right. File downloads tend to be frustrating in that regard. I would try opening the file using a different window, and use client-side scripting to redirect.

Oct 31 '07 #2
533 Expert 512MB
Hi Andy,

Jared has made a very good suggestion, lots of sites use the Javascript mini-window technique (such as download.com), however, you have to advise your users to accept popups otherwise the download window won't open and your user will just be sat there without their file and wondering why!

The other technique you could try is as follows:

1) ASP page loaded to client
2) User submits form, requesting file
3) Upon form submission, user is passed to final "step 5" page containing <iframe>
4) Iframe points to ASP file that generates user-requested file and writes to response (which will then ping up the "Download File" dialog).

This is the technique that Microsoft and SourceForge use, and avoids the popup window issue.

Hope it helps!

Best regards,

Oct 31 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by shank | last post: by
3 posts views Thread by Paul | last post: by
6 posts views Thread by Sam | last post: by
6 posts views Thread by Peter Row | last post: by
8 posts views Thread by Andreas Klemt | last post: by
10 posts views Thread by Urs Eichmann | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by mdpf | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.