By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,312 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,312 IT Pros & Developers. It's quick & easy.

ASP Net IE6 - export data to Excel - Page_Load twice and new session fired

P: n/a
Hi everybody,
I'm facing with the following problem (bug ?) :

A page is calling another one (export.aspx) for exporting data to
excel.
The tecnhique used is to create a Excel-MIME stream for viewing it
directly in the browser.
(below is a sample code)
When the page is called from IE6 (6.0, sp1...) the Page_Load is fired
twice and the second time a new session is created ;
and of course, I've lost all my session variables...
When the page is called from IE5.5, everything is OK.

I've tried several "tricks" with no success : suppress the frames from
the caller page, open the export.aspx in a new window,
move the code from Page_Load to Page_PreRender...
[I've read some similar behaviour with PDF.]
If a attach a file with :
Response.AddHeader("content-disposition", "attachment;
filename=MyFile.xls");
it's Ok, but the dialog (Open, Save...) is displayed, and I don't want
this.

W2K, Framework 1.1, IE6.0sp1, Office 2000

Any help will be appreciated.
-------
private void Page_Load(object sender, System.EventArgs e)
{
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
Response.Write("<TABLE><TR><TD>This should appear in
Excel</TD></TR></TABLE>");
Response.End();
}
Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.