469,643 Members | 2,035 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Window closes unexpectedly when downloading a file

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

Feb 22 '07 #1
3 1807
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.
<bf*********@gmail.coma écrit dans le message de news:
11**********************@q2g2000cwa.googlegroups.c om...
>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

Feb 22 '07 #2
On Feb 22, 11:09 am, "Patrice" <http://www.chez.com/scribe/wrote:
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.

<bfmcfarl...@gmail.coma écrit dans le message de news:
1172163460.993107.134...@q2g2000cwa.googlegroups.c om...
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- Hide quoted text -

- 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?

Feb 22 '07 #3
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.

<bf*********@gmail.coma écrit dans le message de news:
11**********************@m58g2000cwm.googlegroups. com...
On Feb 22, 11:09 am, "Patrice" <http://www.chez.com/scribe/wrote:
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.

<bfmcfarl...@gmail.coma écrit dans le message de news:
1172163460.993107.134...@q2g2000cwa.googlegroups.c om...
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- Hide quoted text -

- 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?
Feb 22 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by news.versatel.de | last post: by
3 posts views Thread by Ramesh Dodamani | last post: by
37 posts views Thread by Jan Tovgaard | last post: by
3 posts views Thread by Johnson | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.