Link to home
Start Free TrialLog in
Avatar of montyexchange
montyexchange

asked on

Internet Explorer and ContentType="text/plain"

I have created a number of .asp files setting the Response.ContentType property to a value of "text/plain".  However, when I attempt to view these pages in IE (6+) it attempts to download them as if they are suspicious file types, instead of displaying the text data to the screen.  I've been able to work around it fairly easily by immediately opening the file in Notepad, but it is becoming tiresome.  

Originally I thought it was a new "feature" in IE 6, but since have discovered that only IE 6 on my machine has this "feature".  Any suggestions?

Thanks in advance.
Avatar of substand
substand

try setting the content to text instead of text/plain.

alternatively, you can try setting it to:

text/x-something


normally, the x will qualify as "experimental", and you might be able to view it like that.


also, you could edit the files where the first line is "<pre>" and the last line is "</pre>" and then ignore the type or set it to "text/html"

if the first 2 don't work, the last one should.
Avatar of montyexchange

ASKER

Thanks for you input substand, but no dice on those suggestions.  I tried both the ="text" and ="text/x-something", neither of which displayed, both of which attempted to download.  

Some more info that might be helpful... The dialog box that pops up with info about the download says the following:
'Some files can harm your computer.  If the file information below looks suspicious, or you do not fully trust the source, do not open or save this file.

File name: monitor.asp
File type: ASP File
From: www....net

This type of file could harm your computer if it contains malicious code.

Would you like to open the file or save it to your computer?

Open | Save | Cancel | More Info'

Thanks.
huh.  thats wierd.  can you put the <pre> tags in, or are you looking to not change the source code?

substand,

I'd rather not change the source code, but could if necessary.  Maybe I'll try that out.  I'm beginning to think that its some sort of conflict with other installed software (Visual Studio 6?).  

Thanks.
well, i suppose, rather than changing the source, you could do a file like:

<!--- begin file --->
<pre>
<include requestedfile so you don't have to change source code>
</pre>
<!--- end file ---->


then link to that file, we'll call it showsource.asp like:

<a href="showsource.asp?file=realfilename.asp">realfilename</a>

ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial