Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 11th, 2003, 09:56 AM
Friend of Wrox
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default text/plain forces download

I've got something weird going on with ASP/IE and I was wondering if anyone else has seen it. Basically, I'm trying to send plain text to the browser from an ASP page, but I just get a file download dialog when I run the page.

Here's a simple test page which exhibits this behaviour
<%@ Language=VBScript EnableSessionState=False %>
<% Response.ContentType = "text/plain"
When I browse to this page I just get a file download dialog. Its weird. I can browse to a text file and it displays just fine.

I tried telnet'ing to this page to see if any strange headers were being sent by ASP but I just got this standard looking stuff:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Thu, 11 Sep 2003 14:41:52 GMT
Connection: Keep-Alive
Content-Length: 4
Content-Type: text/plain
Cache-control: private

Just had a thought while I was typing this and tried it with Netscape 6.2 and it displayed the text "abcd" in the browser just fine, so it must be some weirdness in IE6.

Anyone know anything about it?
Reply With Quote
  #2 (permalink)  
Old September 12th, 2003, 05:33 AM
Friend of Wrox
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post

For the sake of the archive, I've found a workaround for this; add this line:
Response.AddHeader "Content-Disposition", "inline;filename=temp.txt"

Yes, I know that adding a filename to the inline looks like nonsense, but I found an article in MSDN about how IE decides on the MIME type. This article talked about it looking at a combination of
- content-type header
- actual data sent
- file extension
(interestingly, it said that IE searches for a number of pre-defined content-types such as text/html, but text/plain isn't one of them!)

so, I decided that the .asp extension was probably confusing it and the only way I could think to associate it with a text file was to use the Content-Disposition header.

BTW it still works in NS6.2

Well, there you go, problem solved
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Grouping plain text into paragraphs igraham XSLT 4 July 16th, 2007 01:10 PM
getting plain text for .svc file bhavsac Windows Communication Foundation 8 November 9th, 2006 02:27 PM
Changing between bold and plain text in a text box funkybuddha Access 2 January 3rd, 2006 10:15 AM

All times are GMT -4. The time now is 06:06 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.