Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

changing content types

Posted on 1998-12-10
3
187 Views
Last Modified: 2013-12-25
Instead of, or in addition to displaying a table of information about a database record returned on a web browser, I would like that table to be saved as a text file. How can I go about doing this? The book I have says you can change the content-type by saying:

   Response.Expires = 0
   Response.Buffer = TRUE
   Response.Clear
   Response.ContentType = "text/plain"

But that doesn't work. The idea is for the user to be prompted where to save a file which contains a record's data formatted as a table and based on the his/her query. I was hoping the prompt would appear by specifying a MIME type that the browser doesn't recognize. This is the only way I can think of to have the user prompted for a location to save a file. And the file is dynamic (generated on the fly) compared to a static type that resides on the server. Please help ASAP.
0
Comment
Question by:Pakdude
  • 2
3 Comments
 

Author Comment

by:Pakdude
ID: 1857104
Adjusted points to 240
0
 
LVL 1

Accepted Solution

by:
tjp earned 240 total points
ID: 1857105
This problem is discussed often on ASP mailing lists.  The best answer that's been thought of so far is to use the FileSystemObject's CreateTextFile() method to write the data to a file with a .WRI extension.  The browser will not try to display this file, unlike what happens when using a .TXT or .HTM extension.

You could display the data in their browser as usual, and also have a <META HTTP-EQUIV="refresh" CONTENT="1; URL="http://www.domain.com/site/file.wri"> to initiate a download of the information as well.  To make this all happen in one ASP, use Response.Buffer and also put the code to write out the text file before the META tag is sent to the client's browser.

0
 

Author Comment

by:Pakdude
ID: 1857106
Can you provide a bit of code to demonstrate? I'm getting confused with what to write in what files. I get Response object error 'ASP 0156 : 80004005'  Header Error because of the Expires = 0 part. That's what the Professional ASP book by Wrox says to use though. Microsoft doesn't have a solution for this. See Article ID: Q175324.


0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
push logos in footer up higher 5 25
PHP Installer 5 37
website rewamp 5 42
Magento: different theme for Pc and for mobile devices 4 31
Read about why website design really matters in today's demanding market.
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question