Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Window closes unexpectedly when downloading a file

Reply
Thread Tools

Window closes unexpectedly when downloading a file

 
 
bfmcfarlane@gmail.com
Guest
Posts: n/a
 
      02-22-2007
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

 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      02-22-2007
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.


<(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed) 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
>



 
Reply With Quote
 
 
 
 
bfmcfarlane@gmail.com
Guest
Posts: n/a
 
      02-22-2007
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.
>
> <(E-Mail Removed)> a écrit dans le message de news:
> (E-Mail Removed) 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?

 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      02-22-2007
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.

<(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed). 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.
>
> <(E-Mail Removed)> a écrit dans le message de news:
> (E-Mail Removed) 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?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Studio Closes Unexpectedly Johnson ASP .Net 3 11-06-2008 09:07 PM
Java Web Start Console closes unexpectedly / Reading in data ChrisC Java 11 02-07-2007 05:19 AM
Results from child window submit into parent window, then child closes -- How To? Spammay Blockay Javascript 1 02-04-2005 12:47 PM
&read_file in File::Slurp terminates unexpectedly on file Charles R. Thompson Perl Misc 6 01-13-2004 04:00 PM
server needs to know when user closes browser window feng ASP .Net 1 12-03-2003 06:54 PM



Advertisments