Excel not opening file from asp.net web form

C

C O'Brien

I'm currently working on an intranet web site. One of the features is an
export from many of the datagrids on the site. The code that is creating the
excel file is pretty simple:

rendercontrol into HtmlTextWriter

Then add specific response information:

Response.Clear()
Response.AddHeader("Content-Disposition", "attachment;
filename=DataQuery.xls")
Response.ContentType = "application/vnd.ms-excel"
Response.Write(strHolder)
Response.End()

When the export button is clicked, code runs as expected and user is
presented with Open, Save dialog box. When user clicks Open, Excel opens and
an error tells the user that the file can't be found. If user just clicks OK
and closes error -- here is the tricky part, AND LEAVES EXCEL OPEN -- and
clicks on export button again, the file opens into excel with no problems.
The interesting thing is that EXCEL MUST ALREADY BE OPEN for this work
properly.

This behavior is recent and has only presented itself after machines had
been upgraded.

Old machines were Win2000 running IE 6.0.2600
New machines are WinXP running IE 6.0.2800 sp2
Excel has not changed and is 2000 sp3.

Any insight into this would be much appreciated.

-C O'Brien
 

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

Top