This is from and IIS page and I haven't tried in a servlet, but I expect the
HTTPSerlvetResponse has similar functionality

All thinigs seem to be need to be set correctly for it to work. Does this
work in Nutscape 6? I've had to do similar stuff 6 to get it to work.

Setting the buffer to false is a biggie as well as doing a binary write

' Send the HTML page back to the browser.
Response.Buffer = False
Response.CacheControl = "private"
Response.ContentType = "application/"
Response.AddHeader "content-disposition", "attachment; filename=" &
Response.BinaryWrite strHTMLResponse



BTW: I know "ravi" is kinda popular name, but did you every work at

Michael J. Geiser

"ravi" wrote in message


I am trying to setup downloading an excel file from a java
servlet. I have set the content type as follows.


Note that, this works fine using Netscape. But with IE
(6.0 / 5.5), it gives the following error:

Microsoft Excel cannot access the
file "". There are
several possible reasons:......

Also, note that if I set the content type to text, then
the data is properly displayed in the browser.

Any help is highly appriciated.