473,799 Members | 3,025 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to prevent ASP.NET from changing the file extension on SaveAs-Box?

Hi Group,
in my aspx page there is an Response.Redire ct to a file called myfile.csv.
The file consists of plain text with comma separated values.
I want that the browser opens the save as dialog which it does.
So far so good.

But the filename, the Internet Explorer suggests is not myfile.csv but myfile.xls.
Why does the IE change the file extension?

How can I have the save as dialog with the correct suggestion of the filename?

Any help appreciated,
Winston
Nov 18 '05 #1
5 1835
Winston,
You can probably try to alter the MIME types on the server, but if
you're redirecting to a csv there probably isn't much. IE is probably
identifying the csv with Excel since it is a commonly used file to import
data into Excel or out of it. You can try something like identifying a MIME
type of csv to application/octet-stream so that IE will hopefully be forced
to download it.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Winston" <wi***********@ gmx.net> wrote in message
news:a0******** *************** ***@posting.goo gle.com...
Hi Group,
in my aspx page there is an Response.Redire ct to a file called myfile.csv.
The file consists of plain text with comma separated values.
I want that the browser opens the save as dialog which it does.
So far so good.

But the filename, the Internet Explorer suggests is not myfile.csv but myfile.xls. Why does the IE change the file extension?

How can I have the save as dialog with the correct suggestion of the filename?
Any help appreciated,
Winston

Nov 18 '05 #2
Some code like this should do the trick.
Response.AddHea der("Content-Disposition","a ttachment;filen ame=myfile.csv" );

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Winston" <wi***********@ gmx.net> wrote in message
news:a0******** *************** ***@posting.goo gle.com...
Hi Group,
in my aspx page there is an Response.Redire ct to a file called myfile.csv.
The file consists of plain text with comma separated values.
I want that the browser opens the save as dialog which it does.
So far so good.

But the filename, the Internet Explorer suggests is not myfile.csv but myfile.xls. Why does the IE change the file extension?

How can I have the save as dialog with the correct suggestion of the filename?
Any help appreciated,
Winston

Nov 18 '05 #3
"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message news:<#$******* *******@tk2msft ngp13.phx.gbl>. ..
Some code like this should do the trick.
Response.AddHea der("Content-Disposition","a ttachment;filen ame=myfile.csv" );
Hi Steve,
unfortunately not. I tried it and the IE still changes the file
extension from .csv to .xls. Any ideas?

Winston
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Winston" <wi***********@ gmx.net> wrote in message
news:a0******** *************** ***@posting.goo gle.com...
Hi Group,
in my aspx page there is an Response.Redire ct to a file called myfile.csv.
The file consists of plain text with comma separated values.
I want that the browser opens the save as dialog which it does.
So far so good.

But the filename, the Internet Explorer suggests is not myfile.csv but

myfile.xls.
Why does the IE change the file extension?

How can I have the save as dialog with the correct suggestion of the

filename?

Any help appreciated,
Winston

Nov 18 '05 #4
Excel is the default application associated with CSV files.
But it seems you don't want your CSV files associated with Excel?
Can you use another extension besides CSV?

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Winston" <wi***********@ gmx.net> wrote in message
news:a0******** *************** ***@posting.goo gle.com...
"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message

news:<#$******* *******@tk2msft ngp13.phx.gbl>. ..
Some code like this should do the trick.
Response.AddHea der("Content-Disposition","a ttachment;filen ame=myfile.csv" );

Hi Steve,
unfortunately not. I tried it and the IE still changes the file
extension from .csv to .xls. Any ideas?

Winston
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Winston" <wi***********@ gmx.net> wrote in message
news:a0******** *************** ***@posting.goo gle.com...
Hi Group,
in my aspx page there is an Response.Redire ct to a file called myfile.csv. The file consists of plain text with comma separated values.
I want that the browser opens the save as dialog which it does.
So far so good.

But the filename, the Internet Explorer suggests is not myfile.csv but

myfile.xls.
Why does the IE change the file extension?

How can I have the save as dialog with the correct suggestion of the

filename?

Any help appreciated,
Winston

Nov 18 '05 #5
Is there a public URL that you've got this code running on? I'd like to
look at the Headers.

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.

"Winston" <wi***********@ gmx.net> wrote in message
news:a0******** *************** ***@posting.goo gle.com...
"Steve C. Orr [MVP, MCSD]" <St***@Orr.ne t> wrote in message

news:<#$******* *******@tk2msft ngp13.phx.gbl>. ..
Some code like this should do the trick.
Response.AddHea der("Content-Disposition","a ttachment;filen ame=myfile.csv" );

Hi Steve,
unfortunately not. I tried it and the IE still changes the file
extension from .csv to .xls. Any ideas?

Winston
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Winston" <wi***********@ gmx.net> wrote in message
news:a0******** *************** ***@posting.goo gle.com...
Hi Group,
in my aspx page there is an Response.Redire ct to a file called myfile.csv. The file consists of plain text with comma separated values.
I want that the browser opens the save as dialog which it does.
So far so good.

But the filename, the Internet Explorer suggests is not myfile.csv but

myfile.xls.
Why does the IE change the file extension?

How can I have the save as dialog with the correct suggestion of the

filename?

Any help appreciated,
Winston

Nov 18 '05 #6

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

Similar topics

3
6268
by: zfeld | last post by:
My app is creating a word document which my app calls saveas() and saves it to a given directory that is being watched by a fileSystemWatcher. The problem is that the fileSystemEventHandler for creation is only called for the temporary filed created by word which shows up as ~$documentName.doc the real file named MyDocument.doc will never invoke the fileSystemEventHandler for creation. Now when the user closes Word the temporary file is...
3
3799
by: David Kenneally | last post by:
Hello- I'm having a problem doing a file upload from within the edit function of a datalist. I have a simple file upload that works on a standard ..net page: <td width="53"><input id="inpFileUp" type="file" runat="Server" />&nbsp;</td> <asp:Button id="Button1" onclick="Button_Click2" Runat="Server" Text="Upload File!"></asp:Button>
3
367
by: zfeld | last post by:
My app is creating a word document which my app calls saveas() and saves it to a given directory that is being watched by a fileSystemWatcher. The problem is that the fileSystemEventHandler for creation is only called for the temporary filed created by word which shows up as ~$documentName.doc the real file named MyDocument.doc will never invoke the fileSystemEventHandler for creation. Now when the user closes Word the temporary file is...
3
3253
by: Hamayun Khan | last post by:
I have Two asp pages addfiles.asp insert.asp addfiles.asp is used to browse the files which i want to upload to server. in IE both the pages run and the files uploads ok. There is problem in firefox.
2
1714
by: Sabine Dinis Blochberger | last post by:
Johnson Scaria John wrote: Reply and Follow-up to comp.lang.javascript -- Sabine Dinis Blochberger Op3racional www.op3racional.eu
0
9546
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10491
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
10268
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...
0
10031
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
6809
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
5467
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...
0
5593
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.