473,796 Members | 2,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xBrowser CSV Content Types

Hi,

Ive got a button on a page which creates a CSV and writes it to the
response stream for the user to download...

private void btnCSV_Click(ob ject sender, EventArgs e)
{
Response.Conten tType = "text/plain";
Response.AddHea der("content-disposition", "attachment ; filename=
\"List.csv\" ");
Response.Write( CreateCSV());
Response.End();
}

This works fine in IE.

In FF however, if i chose "open with excel" it saves the file in the
temp folder as "List.csv.x ls", so when excel tries to open it it
thinks its an xls and doesnt parse it correctly as a csv :( If i save
it then open it, it of course works fine.

Is this just a problem with FF/Excel, or is there something i can do
with the content-type/other headers to fix this?

Thanks

Andrew

Mar 27 '07 #1
1 1465
If I had to take a guess, I would guess that it is one of two things:

1. Firefox is attempting to correct to known types (possible)
2. Firefox is calling a windows API call that corrects to known types
(probable)

Either way, the only way "around" the issue is to change to Excel (and
convert list to table) when you detect firefox and allow the user to save
off as CSV. There is probably another creative way around, but it is not
coming to mind at this point in time.

There were a lot of issues with the last NetScape/Microsoft fight in the
late nineties. As the web has become more complex, or rather "the browsers",
this second fight (Firefox, ultimately, comes from NetScape) is a bit
messier. It gets even more fun when you start dealing with "standards" and
how each side interprets them. :-)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** ***************
Think outside the box!
*************** *************** ***************
<tr******@hotma il.comwrote in message
news:11******** **************@ b75g2000hsg.goo glegroups.com.. .
Hi,

Ive got a button on a page which creates a CSV and writes it to the
response stream for the user to download...

private void btnCSV_Click(ob ject sender, EventArgs e)
{
Response.Conten tType = "text/plain";
Response.AddHea der("content-disposition", "attachment ; filename=
\"List.csv\" ");
Response.Write( CreateCSV());
Response.End();
}

This works fine in IE.

In FF however, if i chose "open with excel" it saves the file in the
temp folder as "List.csv.x ls", so when excel tries to open it it
thinks its an xls and doesnt parse it correctly as a csv :( If i save
it then open it, it of course works fine.

Is this just a problem with FF/Excel, or is there something i can do
with the content-type/other headers to fix this?

Thanks

Andrew
Mar 27 '07 #2

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

Similar topics

12
3230
by: jonathan.beckett | last post by:
Hi All, For the past few months I have been working on an open source Apache/PHP/MySQL content management system - and have recently made it available for download. It's still very much a work in progress (current release version is 0.4.6), but you should get a very good idea of what it's about by visiting the site (which uses it, funnily enough), or downloading a copy of it and trying it out.
0
2327
by: jonathan.beckett | last post by:
Hi All, I have just made version 0.4.8 of the PluggedOut CMS Content Management System available for download - it's free, and covered by the GPL. It's still very much a work in progress (current release version is 0.4.8), but you should get a very good idea of what it's about by visiting the site (which uses it, funnily enough), or downloading a copy of it and trying it out.
5
1490
by: Richard Light | last post by:
A literal-minded reading of the XML 1.0 Spec suggests that elements with content model ANY should not have comments or PIs as their immediate children. Is there a particular reason for this? Richard Light -- Richard Light SGML/XML and Museum Information Consultancy richard@light.demon.co.uk
17
2184
by: ccdrbrg | last post by:
This is a rather general subject, I apologize. I am new to XHTML, CSS, et al and I am having trouble understanding the DTD and xml namespace declarations. For example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DT¬D/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
0
1811
by: alexsink | last post by:
I am trying to get apache content negotiation to redirect only zh-CN(mainland China, where Simplified Chinese translations are available) language types to Chinese web pages, and have all other variants of Chinese language tags(ie zh-TW) point to English-suffix pages. Our site currently has content negotiation set up for several other languages, and we have the corresponding html files for those languages being properly served. After...
4
1148
by: drclue | last post by:
I have this sorta nifty SVG speaker selection widget I'm developing. http://kirksaeter.com/SpeakerSelector/Assets/Images/SpeakerSelector.svg I've been regularly validating it ( minutes ago was most recent ) http://validator.w3.org/check?uri=http%3A%2F%2Fkirksaeter.com%2FSpeakerSelector%2FAssets%2FImages%2FSpeakerSelector.svg&charset=%28detect+automatically%29&doctype=SVG+1.1&verbose=1 The image is contained in the fallowing page...
4
1389
by: Janto Dreijer | last post by:
Hi! The Nokia Java SDK allows one to define multiple content-types in a single HTTP header field. I'm not sure if it's standard, but it's happening from some Java-enabled phones. This breaks the FieldStorage class in cgi.py by not causing self.read_urlencoded() to be called at object init. Specifically when one gets a type value like 'text/plain, application/x-www-form- urlencoded'.
14
9508
by: Brad | last post by:
I have a .net 2.0 web application project that creates a pdf file, saves the pdf to disk (crystal reports does this part), and then my code reads the pdf file and writes it to the httpresponse The web app works great on win2003 and xp and the end result is a pdf file is displayed in the browser. When I run the same code on Vista, the browser displays the message "Internet Explorer cannot display the web page". If I open the same...
0
10461
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10190
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.