Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

download text file, don't open it

Status
Not open for further replies.

BrianB

Programmer
Oct 2, 2000
186
US
Hello all,
I have an asp database application that lets users generate dynamic reports about customers. They want to download these reports to their own computers for inclusion in paper reports and other uses.

The report is built using HTML tables. Using the file system object, it is a snap to save it to a location on the server for downloading.

However, IE insists on opening all .html, .rtf, and .txt files itself. Many of my users have trouble with the "save as" concept, so I want my users to get a download this file dialog. I want it to prompt for where to save MyReport.txt, instead of opening it.

Any ideas?

Thanks in advance.


Brian


 
Or make it a .zip if all else fails. DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
You know, it never fails. I post a message to Tek-Tips, many kind people reply to my question, and five minutes later, I find the answer on my own.

The secret is to add headers to the response flagging the content as a msdownload.

Response.AddHeader "Content-Type","application/x-msdownload"

Thanks for the suggestions.

Now if I could only get MS Word 97 to handle HTML tables...


-Brian
 
Why the !%$@ would you want to use word 97 ???????????? Regards

Big Dave


** If I am wrong I am sorry, but i'm only trying to help!! **

 
Tell me about it. About 1/3 of the client's boxes are Win 95 (!) using Office 97, 1/3 are Citrix NT4 using Office 97, and 1/3 are Win2K using Office 2000. They don't seem to see this as a problem.

Nor do they understand why this would cause any difficulties for someone developing web based applications for them. Citrix rules out any client side ActiveX, Office 97 can't open tables, and the users have a lot of trouble with the Save As concept for saving web pages. The best solution we are left with is two links: one for "download to Word 2000" and one for "Download to Excel" with a suggestion for Word 97 users that they open the document in Excel and copy the tables to Word by hand.

Let me tell you about the joy we had trying to build this as an MS Access app with 2/3 of the users on Access 97 and 1/3 on Access 2K! We maintained two different code bases, and coordinated two different ODBC drivers for two different data sources (Oracle and Jet). Really, the web solution has been the best option so far. It puts all the code and configuration in one place.

Besides, they tell me it is temporary. We may get to redo the whole project in jsp in another six months, or not.

-Brian



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top