views:

229

answers:

3

I am encountering error like

test(10)[1].csv file cannot be found at 
C:\Documents and Settings\Ron\Local Settings\Temporary Internet Files\Content.IE5\PQ0STUVW

When trying to do export of CSV file using the following codes. Anyone have any idea what could be wrong? This issue does not occur in IE7 / Firefox and is only specific to IE6.

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + fileFullName);
A: 

Are there "special" characters in your "fileFullName"? You cold also try to check the length of your file name, I once had an issue with IE6 when the file name got too long.

Just to be on the safe side: your "fileFullName" only contains the name of the file and not the path, right?

A: 

I'm not sure exactly why the filename is getting munged, but the 'not found' in IE usually means that you're also setting no-cache headers, or a cache time of zero seconds.

If I remember correctly, IE can't open the file directly - it has to cache it first, and then open it from the cache. So you have to allow it to be cached.

This means that: 1. For things to work properly, the file name needs to be unique each time - I usually add the timestamp (to the millisecond) to the filename.

  1. So as to keep your clients' caches from growing unnecessarily, you should probably set the cache time to something short (1 or 2 seconds or so), but definitely not 0;
+1  A: 

I've already got that problem and asked the question that as a correct answer (or, shall I say, a good workaround for IE).

paulgreg