IE throws error message when downloading a file from ASP.NET web p

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have export to xls functionality in asp.net web form, implemented like this:

Response.Clear();
Response.AddHeader("Content-Disposition", "attachment;
filename=InvChangeHistory.xls");
Response.AddHeader("Content-Length", fileToSend.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(fileToSend.FullName);
Response.End();

when trying to download the file, and choosing Open in the IE dialog IE
throws this error:

Cannot find the C:\Documents and Settings\XXX_XXXX\Local Settings\Temporary
Internet Files\Content.IE5\QGN5CF6S\XXXXXX[1].xls file.

when saving the file, the file gets created in the temp directory and is
saved.

I am a missing a setting in the header, or is it IIS setting. This used to
work on other test web servers.

Thanks.
 
Most of the time this error occurs because of content expiration header
values set to expire the documents immediately. Or if the site is using SSL.
Do you have any of these 2?
 
I don't set the context expiration in the header explicitely. Do I need to do
that ?
The site is not using SSL.

Why is only happen on some test servers ? Is there a setting about this in
IIS as well ? (default expiration or something)

Winista said:
Most of the time this error occurs because of content expiration header
values set to expire the documents immediately. Or if the site is using SSL.
Do you have any of these 2?

OliviuG said:
I have export to xls functionality in asp.net web form, implemented like
this:

Response.Clear();
Response.AddHeader("Content-Disposition", "attachment;
filename=InvChangeHistory.xls");
Response.AddHeader("Content-Length", fileToSend.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(fileToSend.FullName);
Response.End();

when trying to download the file, and choosing Open in the IE dialog IE
throws this error:

Cannot find the C:\Documents and Settings\XXX_XXXX\Local
Settings\Temporary
Internet Files\Content.IE5\QGN5CF6S\XXXXXX[1].xls file.

when saving the file, the file gets created in the temp directory and is
saved.

I am a missing a setting in the header, or is it IIS setting. This used to
work on other test web servers.

Thanks.
 
Back
Top