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

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: David Wang [Msft] (someone_at_online.microsoft.com)
Date: 02/16/04


Date: Mon, 16 Feb 2004 15:08:01 -0800

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.

-- 
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"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