473,326 Members | 2,134 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,326 software developers and data experts.

CSV download from aspx page has corrupt sheet name using MSIE/Excel

Hello,

When I use the follwing aspx code to get a csv file via Internet Explorer in
MS Excel, after comfirm dialog box as "Open content immediately" Excel
displays a corrupt worksheet name as given in:
Response.Buffer = True

Response.ClearContent()

Response.ClearHeaders()

Response.Charset = ""

....

Response.AppendHeader("content-length", reportOutput.Length.ToString())

Dim type As String = Request.QueryString("Type")

Dim strFileName As String = Request.Params("FileName")

....
Response.ContentType = "application/csv"

Response.AddHeader("Content-Disposition",
String.Format("attachment;filename={0}.CSV ", strFileName))

....

Response.AddHeader("Content-Transfer-Encoding", "binary")

Response.BinaryWrite(reportOutput)

Response.Flush()

Response.End()

then the CSV file opens as:

'.CSV]fille_name[1]'

This worksheet name cannot even be edited to eg. 'table_1'. Excel does not
accept any typing, complaining "wrong characters".

If I write the file to disk instead of opening it in Excel, everything works
fine when I try to open the saved file afterwards.
I don't have a clue on this... however the HTTP headed looks to come back
correctly from the server:

HTTP/1.1 200 OK
Date: Thu, 09 Nov 2006 17:01:31 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
MicrosoftOfficeWebServer: 5.0_Pub
X-AspNet-Version: 2.0.50727
Content-Length: 7092
Content-Disposition: attachment;filename=Data_Export3732.CSV
Content-Transfer-Encoding: binary
Cache-Control: private
Content-Type: application/vnd.ms-excel
Following the example from this header... the worksheet name will open as
follows in Excel:

..CSV]Data_Export3732(1)

Thanks for any guide...
Nov 9 '06 #1
0 1814

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

Similar topics

7
by: Paul | last post by:
I thought this is more of an IE issue but i've had no joy on that group perhaps somebody here will have a clue. If i click a link to a web page embedded in Excel (97 OR 2000) i get the standard...
2
by: MS | last post by:
We have to provide a facility on the client machines to download the data visible on a ASP page into an excel sheet. We are using WIN2k clients connected to WIN2k server with IE6.0 installed. ...
4
by: Pawel | last post by:
Hello All I tried to embed Excel sheet into HTML page by following command: <iframe src="Tmp.XLS" width="100%" height="500"></iframe> and it works, showing Excel sheet inside the page, but...
0
by: Rhys666 | last post by:
Basically I have a link that opens my download page and the querystring identifies the type of 'template' Excel spreadsheet has asked to download. The download page reads the querystring,...
5
by: Neil Rossi | last post by:
I have an issue with a particular ASP page on two web servers. Let's call these servers Dev1 and Beta1. Both Servers are running IIS 5, Windows 2000 SP4 with "almost" all of the latest patches. ...
18
by: Frank M. Walter | last post by:
Hello, I have made an small AddIn with udf for excel 2003. I use vs2003. The point of view is the function __T() I call it in excel sheet writing =__T() I am not able to set a value to a...
0
by: sunita | last post by:
Hiiii I am opening an aspx page in a showModalDialog...I have and i frame in that popup whose target is another page.. And this is what takes place in that aspx page that is in the iframe...I am...
1
by: =?Utf-8?B?TGFtaXM=?= | last post by:
HI, I am doing an aspx application and need to let my users be able to edit the information in my database by the page. My first Idea was to let them export the information to an excel file at...
7
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.