473,473 Members | 2,304 Online
Bytes | Software Development & Data Engineering Community
Create 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.Redirect 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 1814
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.google.c om...
Hi Group,
in my aspx page there is an Response.Redirect 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.AddHeader("Content-Disposition","attachment;filename=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.google.c om...
Hi Group,
in my aspx page there is an Response.Redirect 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.net> wrote in message news:<#$**************@tk2msftngp13.phx.gbl>...
Some code like this should do the trick.
Response.AddHeader("Content-Disposition","attachment;filename=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.google.c om...
Hi Group,
in my aspx page there is an Response.Redirect 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.google.c om...
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message

news:<#$**************@tk2msftngp13.phx.gbl>...
Some code like this should do the trick.
Response.AddHeader("Content-Disposition","attachment;filename=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.google.c om...
Hi Group,
in my aspx page there is an Response.Redirect 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.google.c om...
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message

news:<#$**************@tk2msftngp13.phx.gbl>...
Some code like this should do the trick.
Response.AddHeader("Content-Disposition","attachment;filename=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.google.c om...
Hi Group,
in my aspx page there is an Response.Redirect 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
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...
3
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...
3
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...
3
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...
2
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
1
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...
0
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...
0
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...
0
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...
0
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 ...
0
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...

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.