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

Default Save as type and filename

Hello,

I have an asp page that produces output from a database. This allows a
simple way for the user to save the data to a text file by going to
File->Save as...

The default save as options always defaults to a particular filename and the
save as type is always html, therefore the user has to manually type a
filename and choose Text File (*.txt) as the type.

I remember I was able to overide ride these options with the following code.

Response.ContentType = "text/plain"
Response.AddHeader "Content-Disposition", "inline; filename=myfilename"

This doesn't seem to be working for me anymore.

Any thoughts?

Kit
Jul 19 '05 #1
2 2965
Would be rather :

Response.AddHeader "Content-Disposition",
"attachment;filename=myfilename.txt"

(attachement instead of inline and note the file extension is included).

Patrice

"Kit Truong" <ki*@e-nablesolutions.ca> a écrit dans le message de
news:pj*****************@news20.bellglobal.com...
Hello,

I have an asp page that produces output from a database. This allows a
simple way for the user to save the data to a text file by going to
File->Save as...

The default save as options always defaults to a particular filename and the save as type is always html, therefore the user has to manually type a
filename and choose Text File (*.txt) as the type.

I remember I was able to overide ride these options with the following code.
Response.ContentType = "text/plain"
Response.AddHeader "Content-Disposition", "inline; filename=myfilename"

This doesn't seem to be working for me anymore.

Any thoughts?

Kit

Jul 19 '05 #2
Hi,
I have a same issue. I was trying to export the results from an ASP
page to an Excel spread sheet. Right now, when I click on the export
button the excel spread sheet opens in an IE, which my client don't
like. So, my question is when I click the export button a Save as
dialogue window should appear to allow me to save the file in an .xls
type, with out opening directly in IE. Is this doable.

Really appreciate your time in replying to this.

Thanks,
Srini.
"Kit Truong" <ki*@e-nablesolutions.ca> wrote in message news:<pj*****************@news20.bellglobal.com>.. .
Hello,

I have an asp page that produces output from a database. This allows a
simple way for the user to save the data to a text file by going to
File->Save as...

The default save as options always defaults to a particular filename and the
save as type is always html, therefore the user has to manually type a
filename and choose Text File (*.txt) as the type.

I remember I was able to overide ride these options with the following code.

Response.ContentType = "text/plain"
Response.AddHeader "Content-Disposition", "inline; filename=myfilename"

This doesn't seem to be working for me anymore.

Any thoughts?

Kit

Jul 19 '05 #3

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

Similar topics

4
by: Dariusz | last post by:
I have the following code which executes successfully to call the browsers "save as" box... //Screensavers if ($FileType == 'scr') { // We'll be outputting a screensaver header('Content-type:...
3
by: nbaxley | last post by:
I'm using a binary stream to send down a file with ASP from the web server. I've been having trouble with IE and getting it to recognize my file. I've added the filename as a...
1
by: Wayne | last post by:
I'm using the following code from the Access Web to open a folder. The folder opens in "List" View. Is there an addition that I can make to the code to force the folder to open in "Details" view?...
0
by: Olav Tollefsen | last post by:
I have an .aspx file with the following code in Form_Load: image = System.Drawing.Image.FromFile(imageFilename); Response.ContentType = "image/jpeg"; image.Save(Response.OutputStream,...
2
by: tedqn | last post by:
I use the Stream method to serve certain file types to the user. If the type is pdf, it opens in the browser fine. My problem is with those that the browser doesn't have plug-ins such as ppt, word,...
13
by: Hemant Sipahimalani | last post by:
The following piece of code is being used to export HTML to excel. HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"...
2
by: vbaDev | last post by:
Hi. I am using Access 2000 and in my code I'm exporting a table into an Excel file (creating it), then the code needs to export another query into the same file (a new worksheet). So I needed both a...
3
by: LordHog | last post by:
Hello, How would I go about finding the default handler, let's say a text file (*.txt), then launch the default handler with the file as an argument? I had found how to launch an external...
1
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or any image file while uploading. i develop...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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
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...
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...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.