473,385 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Internet Explorer cannot open Excel stream

I want to export a datagrid to Excel. Here is the code:

[after datagrid databind]

Response.Clear();

Response.Buffer = true;
Response.AddHeader("content-disposition",
"attachment;filename=FileName.xls");
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.No Cache);
System.IO.StringWriter stringWrite = new
System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new
HtmlTextWriter(stringWrite);
DataGrid1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();

When I open the page with Internet Explorer I get this:

Internet Explorer cannot download [file name] from [server name]
Internet Explorer was not able to open this Internet site. The
requested site is either unavailable or cannot be found. Please try
again later.

The funny thing: it works with Firefox - no problems at all.
Mime types on IIS are ok.
Feb 15 '08 #1
0 2879

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bill Thom | last post by:
I have a Microsoft Access 2000 (9.0.4402 SR-1) database that I am attempting to launch from a hyperlink using Internet Explorer (Version 6.0.2800.1106). If I attempt to launch the database from...
2
by: Neil | last post by:
Hi I'm rendering my datagrid to a HTML stream with a .xls extension to open in Excel however it opens in the browser. Is there a way to programatically force it to open Excel? I know you can...
2
by: CathieC | last post by:
I have a websote developed using visual studio 2005 beta , .net version 2 i deploy my application to a server and it is run from client computers. One of the users gets the error "Internet...
3
by: laredotornado | last post by:
Hi, This problem only affects PC IE. On a secured page (a page visited via https), there is a link that reads -- "Download HTML File". The link connects to this page <?php...
1
by: Christian W Larsen | last post by:
I want to export a datagrid to Excel. Here is the code: Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition",
2
by: cwlarsen | last post by:
I want to export a datagrid to Excel. Here is the code: Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition",
1
by: =?Utf-8?B?UGF5cm9sbCBmcnVzdHJhdGVk?= | last post by:
I am on my work computer using Windows XP, I am am using Internet Explorer 7.0 also. I am on a payroll website to do my weekly payroll. I try and view my payroll before processing it so I try and...
1
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/download2.php Whenever I get that page, I get the following error: --------------------- Internet Explorer cannot download download2.php from...
2
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.