SuchitK

Hi,

Have been working on this issue for the past 2 days and nt able to get it resolved. I am having a Servlet which is used to download a file to the client. After a successful download I am removing it from the session since it need not be downloaded again.
The issue is that when I attempt the same with IE7 with default setting IE7 blocks the download and thus displays the information Bar regarding the blocked download. However in reality the code in the servlet is executed without any exception being thrown (Since IE7 has blocked the download), thus making it impossible to track an event that the download is blocked. In turn hence, the bean is getting deleted from session and when the user allows the Download from the info bar, the bean is not there in the session and thus cannot download. The code in my servlet is

File f = new File ("c:/test.txt");

response.setContentType("application/vnd.ms-excel");
//response.setContentType("application/x-download");
response.addHeader("Content-Disposition", "attachment; filename=\"" + getDateString() + "download.csv\" ");

InputStream in = new FileInputStream(f);

BufferedInputStream bufferedFileInputStream = new BufferedInputStream(in);


byte[] buffer = new byte[4096];
int bytesRead = 0;
BufferedOutputStream outs = new BufferedOutputStream(out, 4096);
while ((bytesRead = in.read(buffer)) != -1) {
outs.write(buffer, 0, bytesRead);
outs.flush();
}
P.S. I would not want to change the setting in IE. These need to remain



Re: Internet Explorer Extension Development Issue Downloading a file in IE7

Part Time Australian

I am also experiencing a similar problem.

In my code behind I have

Code Snippet

Response.Clear();

Response.ClearHeaders();

Response.Buffer = true;

Response.ContentType = "application/vnd.ms-excel";

Response.AddHeader("Content-Disposition", "inline;filename=\"PoleTransfer.xls\"");

Response.Charset = "";

this.EnableViewState = false;

Response.OutputStream.Write(bytes, 0, bytes.Length);

Response.Flush();

I have also tried attachment rather than inline.

The problem is that I am displaying a popup with this code behind and IE 7 seems to deny the excel output and closes the popup.

Thanks for any help.





Re: Internet Explorer Extension Development Issue Downloading a file in IE7

blackphinga

Have you had any luck with this We are experiencing the sameissue with our app. One thing that we have found is that if you hold down 'ctrl' then click it let's it kick off. Leads me to believe that it is possibly a header issue or perhaps a security setting in IIS. Seems to work fine in an Intranet environment.



Re: Internet Explorer Extension Development Issue Downloading a file in IE7

Part Time Australian

I gave up and removed the popup.





Re: Internet Explorer Extension Development Issue Downloading a file in IE7

ksek

did that resolve the issue