Cannot open Excel file after it is downloaded

I am getting the following error…

‘c:\Documents and Settings\john.livermore\Local Settings\Temporary Internet Files\Content.IE5\8DARKL23\schedule[1].xls’ could not be found.

This is what my save call looks like…

excel.Save(“schedule.xls”, SaveType.OpenInExcel, FileFormatType.Excel2003, Response);


Any ideas as to what the problem is?

Thanks,
John

Some more information. I can save the file and open it just fine. If I choose the ‘Open’ option, that is when I get the error.

Since you can save the file and open it fine, it’s not a problem of Aspose.Excel. Other user also had reported this bug and finally we found it’s a problem of IE or IIS.

We use “Content-disposition”, “inline; filename=test.xls” force the browser to open file and “Content-disposition”, “attachment; filename=test.xls” force the browser to open the saveas dialog and use MS Excel to open file.

However, there is some exception :
* Microsoft has a problem with IE 6.0 that they never could fix it, IE 6.0 some times dosn’t follow this rule.
* You may have some problem with this rule if you using IIS or thirdpart HTTP Compression utilities.

Please try your program in another machine or write another simple program to see what happens.

I changed the cache policy for the HttpResponse object to solve this problem. Please try this attached fix.

By the way, Aspose.Excel is now changed to Aspose.Cells. You just need to change the namespace in your applications.

Laurence wrote:
I changed the cache policy for the HttpResponse object to solve this problem. Please try this attached fix.


Could I ask what exactly you did to correct this? I am experiencing this with another application and it appears to be a well recorded problem on other sites/forums. There just seems to be no published solution for the issue. Thanks!

This may be a possible solution:

If I change my caching rules to

response.expires = 1

response.addHeader "cache-control","private"

response.expiresabsolute = Now() -1

response.addHeader "pragma","no-cache"

' Response.CacheControl = "no-cache" 'Texted out

It works fine.