Re: How to set content-type header for ASP/HTML pages only ?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Alan Silver (alan-silver_at_nospam.thanx)
Date: 02/17/04


Date: Tue, 17 Feb 2004 17:41:29 +0000

In article <ebV#DPO9DHA.2404@TK2MSFTNGP11.phx.gbl>, "David Wang [Msft]"
<someone@online.microsoft.com> writes
>The right way to do this association is with a MIME-Type (IIS can configure
>this on a per-URL level, meaning you can even make SOME ASP pages return
>custom values but not others, depending on URL scope), which allows you to
>set the value of the Content-Type header on a per-extension basis. This
>requires restarting IIS for it to take effect.
>
>What you were doing was setting headers that IIS sends on all requests,
>which is valid for other uses, just not for Content-Type.

Thanx for the reply.

I thought that MIME types were only for setting the content type. I want
to set the character encoding. I was doing it via a Content-Type header
as that was a) the way suggested by the W3C and b) 'cos I didn't know
any other way to do it for the whole server.

Do you know how to set the character encoding for all ASP/HTML pages
served ? TIA

>"Alan Silver" <alan-silver@nospam.thanx> wrote in message
>news:TwL$pdLdJPMAFwLh@nospamthankyou.spam...
>Hello,
>
>I would like to set the content-type HTTP header for Content-Type. I
>tried adding the header :-
>
>Content-Type: text/html; charset=ISO-8859-1
>
>as recommended by the W3C, but this sends this header for *all* files
>served, not just ASP and HTML. For example, it sends the header for CSS
>files, which causes the validators to choke.
>
>Is there any way to set the Content-Type specific to file type ? I
>searched Google, but didn't find anything on this. It seems strange to
>be able to set a global Content-Type, but not be able to associate it
>with a file type.
>
>TIA
>
>P.S. I am using IIS4 on NT4 Server if it makes any difference.
>

-- 
Alan Silver


Relevant Pages