File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes unexplained file download behavior Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "unexplained file download behavior" Watch "unexplained file download behavior" New topic

unexplained file download behavior

Carlo de Guzman

Joined: Sep 14, 2005
Posts: 2

I am working on a site that allows the user to download information to an Excel file. If I use the following code:

.AppendHeader("content-disposition", "inline; filename=" & FileName)

The Excel file displays in the current browser window after I click "Open" in the File Download box that appears. However, the user wants the Excel file to appear outside the browser in another window. So I tried using:

.AppendHeader("content-disposition", "attachment; filename=" & FileName)

Using this code, the Excel file opens in its own Excel window just fine. The problem now is that the File Download box appears twice before I am able to view the spreadsheet.

Is there a way so that the File Download box appears only once, similar to what was happening before I made the code change?

Any help would be very much appreciated.

Carlo de Guzman

Joined: Sep 14, 2005
Posts: 2
Just to clarify, the code samples above are inside a "With HttpContext.Current.Response" block. Thanks.
I agree. Here's the link:
subject: unexplained file download behavior
It's not a secret anymore!