473,549 Members | 2,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Conten tType = "text/plain"
Response.AddHea der "Content-Disposition", "inline; filename=myfile name"

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

Any thoughts?

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

Response.AddHea der "Content-Disposition",
"attachment;fil ename=myfilenam e.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******** *********@news2 0.bellglobal.co m...
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.Conten tType = "text/plain"
Response.AddHea der "Content-Disposition", "inline; filename=myfile name"

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******* **********@news 20.bellglobal.c om>...
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.Conten tType = "text/plain"
Response.AddHea der "Content-Disposition", "inline; filename=myfile name"

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
16334
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: application/octet-stream'); // It will be called test.scr header('Content-Disposition: attachment; filename="test.scr"');
3
1670
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 paramater(?filename=file.jpgw) to handle IE's mime type mangling, but I'm still having trouble with IE's default Save As Type being HTML. When we send down a jpgw...
1
2601
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? 'This code was originally written by Ken Getz. 'It is not to be altered or distributed, 'except as part of an application. 'You are free to use...
0
1243
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, System.Drawing.Imaging.ImageFormat.Jpeg); I'm using this to display images in the browser using an URL like this: ...
2
2326
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, etc. it prompts to choose Open/Save/Cancel and defaults the filename to the ASP page serving the content. ie. BinarySend.asp -> BinarySend.doc,...
13
13190
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" HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=ABC.xls") HttpContext.Current.Response.Write(strHTML) HttpContext.Current.Response.End() However when the user tries to...
2
10975
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 "Save As" dialog and the ability to grab the filepath so that the second export appends to it. Anyway, I found Microsofts method and it works,...
3
2537
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 program, but I do not know how I would find the default handler to a file type. Any help is greatly appreciated. Code to launch application:...
1
4868
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 program,which can upload many file in folder.problem is,am unable to save my file name in to database.because i used same name for all input file type as...
0
7542
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7467
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...
0
7736
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. ...
1
7500
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...
0
7827
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...
1
5385
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5110
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...
0
3514
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...
0
783
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...

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.