asp to excel error

M

Mike

I am getting an error on a page that uses asp to query a db then opens the
page on the client in excel. The error is only occuring on XP boxes only.
If I comment out the cache killers it opens fine but I want to make sure a
user gets the most up to date data so I need some cache control in there.
What can I do to fix this?

Thanks
Mike


What I think is pertinent code:

'Cache control
response.expires = 0
response.expiresabsolute = Now() -1
response.addHeader "pragma","no-cache"
response.addHeader "cache-control","private"
Response.CacheControl = "no-cache"

Response.write "<meta http-equiv=""Content-Language"" content=""en-us"">" &
vbCrLf
Response.write "<meta http-equiv=""Content-Type"" content=""text/html;
charset=windows-1252"">" & vbCrLf
Response.ContentType="application/x-msdownload"
Response.AddHeader "Content-Disposition", "attachment; filename=" &
strProject & ".xls;"
 
R

Ray Costanzo [MVP]

What's the error?

You can always do some sort of unique querystring appending to cause the
browser to request a new copy of the Excel file. Just make your link to
your page be something like:

<a href="yourpage.asp?<%=Now%>">your page that gives the workbook</a>

You may want to get a little more creative, but the idea is that if you
change the querystring each time, the browser will not go from its cache.

Ray at work
 
M

Mike

Sorry I guess the error would help. (error Below) I am positive it is a
caching problem in the client configuration. I have seen post all of the
internet about similar things.

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. This should still display a new version of the file each time.

Thanks
Mike


Error --
"'C:\Documents and Settings\<username>\Local Settings\Temporary Internet
Files\Content.IE5\KFCRM1S1\<filename>[1].xls could not be found. Check the
spelling of the file name, and verify that the file location is correct.

If you are trying to open the file from you list of most recently used files
 
P

paul

Or you might try using more generic csv files which of course can be
opened in Excel.

Puzzle 5 Not much different from other solutions by Manohar Kamath
posted 1/12/99
http://www.asp101.com/puzzles/puzzle5_s7.asp

Puzzle 5 "Write delimited data to browser window" by Kirk Lockhart
posted on 12/21/98
Write the data in plain text to the browser window, and the user can
save the results as a plain text file and then import the data into
Excel or whatever application they want.
http://www.asp101.com/puzzles/puzzle5_s1.asp

Creating the Excel File Server Side
http://www.greggriffiths.org/webdev/both/excel/serverside.html
Uses FSO to create a .csv file.

Best regards,
-Paul
www.Bullschmidt.com - Freelance Web and Database Developer
www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

asp page to excel error on XP client 0
wierd error message in asp page 5
asp to excel 1
Forcining An ASP page to expire 1
generate Excel balks 5
Exporting to Excel (xlsx files) 5
Exporting to Excel 0
ASP to EXCEL 1

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top