Window closes unexpectedly when downloading a file

B

bfmcfarlane

I have an appication that allows users to upload and download files.
This application is only accessed when a user clicks on an "Upload /
Download" link from within our main application. A new window is
launched asking the user which file he /she wants to download. After
the user determines which file to download, the window disappears but
the user is provided with the download file dialog box. I have been
able to track it down to a specific line of code that I believe is
causing this behavior.

Response.Clear();
Response.ContentType = "cis/file-text";
Response.AddHeader("Content-Disposition", "attachment; filename=" +
tempFileName);
Response.BinaryWrite(result);

The third line where I provide teh header details causes the page to
close. If I comment out this line, the page does not close and
obviously the file is not downloaded.

If I access this application directly by opening up IE and typing in
the url, this behavior does not occurr and everything works as
designed. I am struggling with why does this only happen when the
appliaction is accessed via javascript.

Any help is appreciated
 
P

Patrice

It never shows a window (the browser sees that the content is not directed
to its window). When used from a browser it acutally just left the current
window unchanged. If you go directly to the url without displaying a browser
window (ie. launched from an external possibly Windows application ?) it
looks like expected it doesn't display anything.
 
B

bfmcfarlane

It never shows a window (the browser sees that the content is not directed
to its window). When used from a browser it acutally just left the current
window unchanged. If you go directly to the url without displaying a browser
window (ie. launched from an external possibly Windows application ?) it
looks like expected it doesn't display anything.

<[email protected]> a écrit dans le message de (e-mail address removed)...








- Show quoted text -

I guess I need to provide more detail. My application contains a
frameset, display and hidden. When the user is navigated to the
application, a list of files to be downloaded appears. The user
clicks on a hyperlink, which calls javascript. The javascript loads a
web page into each frame. The dispaly frame is loaded with a page
asking the user if the file was downloaded succesfully or if an error
occurs. The hidden frame is loaded with a page that retrieves the
file and sends to the user. The user should then go from a list of
files to be downloaded to a confirmation page.

Are you saying that since the hidden frame does not have any content
to output that it will close the entire web browser?
 
P

Patrice

Nope as you see I didn't understood the whole context.

My first move would be to make the hidden frame visible in case initiating a
download from an hidden frame would be something unexpected side effect...
You could also for now get rid of the confirmation page to just keep the
download page the goal for now being to find out what is the change that
would make this work before seeing what could be done about it.

I would aslo likely try a bare bone simialr archtiercture with an IFRAME
just to see...

Good luck.

<[email protected]> a écrit dans le message de
(e-mail address removed)...
It never shows a window (the browser sees that the content is not directed
to its window). When used from a browser it acutally just left the current
window unchanged. If you go directly to the url without displaying a
browser
window (ie. launched from an external possibly Windows application ?) it
looks like expected it doesn't display anything.

<[email protected]> a écrit dans le message de (e-mail address removed)...








- Show quoted text -

I guess I need to provide more detail. My application contains a
frameset, display and hidden. When the user is navigated to the
application, a list of files to be downloaded appears. The user
clicks on a hyperlink, which calls javascript. The javascript loads a
web page into each frame. The dispaly frame is loaded with a page
asking the user if the file was downloaded succesfully or if an error
occurs. The hidden frame is loaded with a page that retrieves the
file and sends to the user. The user should then go from a list of
files to be downloaded to a confirmation page.

Are you saying that since the hidden frame does not have any content
to output that it will close the entire web browser?
 

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

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top