By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,793 Members | 1,269 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,793 IT Pros & Developers. It's quick & easy.

Displaying text/plain as text in IE with asp.net

P: n/a
Is there any way to get Internet explorer to treat a text/plain .net
page as plain text using asp.net? It seems like IE doesn't trust
text/plain as a mime type, and so it (ironically) displays it as
text/html. (This works fine in Mozilla, though.)

I thought maybe IE would use the file extension as a guide, but it
doesn't seem to work. I tried mapping the .txt extension in IIS so it
is parsed by the .net framework, then setting up an HttpModule to map
calls to http://.../MyApp/Test.txt to Test.aspx. The mapping works
fine, but it still displays my plain text as HTML.

Is there another way to generate a plain text page for IE in asp.net?

Thanks,

-Mike

Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Mike,
use , Response.ContentType="text/plain"; in your code..
HTH
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com


"Mike Bridge" <mi**@bridgecanada.com> wrote in message
news:8r********************************@4ax.com...
Is there any way to get Internet explorer to treat a text/plain .net
page as plain text using asp.net? It seems like IE doesn't trust
text/plain as a mime type, and so it (ironically) displays it as
text/html. (This works fine in Mozilla, though.)

I thought maybe IE would use the file extension as a guide, but it
doesn't seem to work. I tried mapping the .txt extension in IIS so it
is parsed by the .net framework, then setting up an HttpModule to map
calls to http://.../MyApp/Test.txt to Test.aspx. The mapping works
fine, but it still displays my plain text as HTML.

Is there another way to generate a plain text page for IE in asp.net?

Thanks,

-Mike

Nov 18 '05 #2

P: n/a
Hi-

Unfortunately, setting the ContentType to text/plain doesn't doesn't
have any effect---it still displays as "text/html". Internet Explorer
designates that all documents with "text/plain" content-types are
"ambiguous" and so it applies some other tests to try to guess what it
is:
http://msdn.microsoft.com/library/de...appendix_a.asp

As far as I can tell, when you designate your page as plain text, the
only thing you can be sure of is that it will not be rendered in IE as
plain text.

-Mike
On Fri, 20 Feb 2004 01:12:01 -0600, "Marshal Antony"
<do***********@yahoo.com> wrote:
Hi Mike,
use , Response.ContentType="text/plain"; in your code..
HTH
Regards,
Marshal Antony
.NET Developer
http://www.dotnetmarshal.com


"Mike Bridge" <mi**@bridgecanada.com> wrote in message
news:8r********************************@4ax.com.. .
Is there any way to get Internet explorer to treat a text/plain .net
page as plain text using asp.net? It seems like IE doesn't trust
text/plain as a mime type, and so it (ironically) displays it as
text/html. (This works fine in Mozilla, though.)

I thought maybe IE would use the file extension as a guide, but it
doesn't seem to work. I tried mapping the .txt extension in IIS so it
is parsed by the .net framework, then setting up an HttpModule to map
calls to http://.../MyApp/Test.txt to Test.aspx. The mapping works
fine, but it still displays my plain text as HTML.

Is there another way to generate a plain text page for IE in asp.net?

Thanks,

-Mike


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.