Close window after binary download

O

Onin Tayson

Hi All,

I have an ASP page that is sent a file location as a parameter. It opens
this file, loads the ADODB.Stream object and does a binary write to the page
forcing the download dialog to appear. If the user selects "Open", "Save"
or "Cancel", the window closes, which is the desired behavior. This all
works fine, until I installed Windows XP SP2. The newly created browser
window remains open after clicking one of the buttons. I've tried a number
of things to get the window to close automagically, but nothing has worked
so far.

I'm calling the ASP page using window.open() because any error encountered
while trying to load the file should display the message to the newly
created window. Please see this link
(http://www.aspfaq.com/show.asp?id=2161#) for reference.

Any help will be greatly appreciated!

Thanks,
 
L

Larry Bud

Onin said:
Hi All,

I have an ASP page that is sent a file location as a parameter. It opens
this file, loads the ADODB.Stream object and does a binary write to the page
forcing the download dialog to appear. If the user selects "Open", "Save"
or "Cancel", the window closes, which is the desired behavior. This all
works fine, until I installed Windows XP SP2. The newly created browser
window remains open after clicking one of the buttons. I've tried a number
of things to get the window to close automagically, but nothing has worked
so far.

If you add

Response.AddHeader "Content-Disposition", "attachment;
filename=thefile.ext"

This will make the file as a separate attachment, and not in a Browser
window. Replace thefile.ext with the actual filename (not the whole
path, just the file).

As far as handling errors, let the browser do it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top