Re: Can I use Data Caching without a Session?

Tech-Archive recommends: Fix windows errors by optimizing your registry



on 19-8-2008, John Kotuby supposed :
Thanks Hans...

When the user clicks the XLS link, I want the page to remain in the background and the Excel file to be downloaded (or opened in Excel itself) rather than displayed in a new page. The idea is to keep the original page in the background while the user can perform multiple tasks. I can only get that to work properly (so far) using a standard hyperlink.


You can do that by setting an Http header value. In the Click handler do something like:

Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("Content-Disposition",
"attachment;filename=summary.xls"); // "save as" filename

// TODO: calculate the xls result

Response.Write(resultString);
// or Response.BinaryWrite(resultByteArray);
Response.End();



Hans Kesting


.