473,513 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1968
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1904
by: news.versatel.de | last post by:
Hello NG, I am using javascript to open a new window like this: printpreview=window.open('printview.php','printprev','width=600,height=600'); The new window has a layer called preview: ...
4
47439
by: Bill | last post by:
I need help closing a CMD window when it is executed from Access. 1) The batch file is called from Access. 2) Access closes, 3) the batch runs a copy of the access database (creating a backup)...
3
3968
by: Ramesh Dodamani | last post by:
Environment: XP Pro, VS.Net 2003, .Net 1.1.4322 with SP1 & KB Hotfix 886903 P4 2.2GHz, 1 GB RAM My system was working fine till a few weeks back when I started seeing the following errors. ...
2
2249
by: BrianHIckman | last post by:
MY MS Access application, all code in VBA, suddenly closes unexpectedly when attempting to open a specific form which contains combos and standard fields, fed by qry A which in turn calls qryB. I...
37
6263
by: Jan Tovgaard | last post by:
Hey everyone:) We have a critical problem, which I can see that other people also has ran into. In Internet Explorer 7 it is no longer possible to do a window.close after opening a window,...
15
12850
by: mlcampeau | last post by:
Does anyone know why my database sometimes closes on its own for no apparent reason? I don't think it has anything to do with my code because, as an example of when it closed on me, I was entering...
5
4666
by: zxo102 | last post by:
Hi, I am trying to use python module smtplib to send my email out on window xp (localhost). import smtplib server = smtplib.SMTP('localhost') but I got the error information as follows: ...
3
10488
by: Johnson | last post by:
I'm not sure if this is an IIS 5.1 issue or ASP.NET issue, or Visual Studio 2008 issue -- thus posting to 3 groups. Please don't be offended. The problem I'm encountering is that Visual Studio...
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7158
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.