IIS 6 - Classic ASP - Set *.asp response header's content-type to "text/html;charset=UTF-8"

DashK picture DashK · Feb 29, 2012 · Viewed 7.9k times · Source

How do I can set *.asp files (Classic ASP) in a Web Site under IIS to have Response Header's Content-Type set to text/html;charset=UTF-8? Right now, the files are served as Content-Type=text/html.

An alternate approach is to add <% Response.Charset = "UTF-8" %> to every single page, but I wonder if there's a way to do it globally.

Thanks! -K

Answer

HeavenCore picture HeavenCore · Feb 29, 2012

EDIT 1: Ive tested this with IE9's developer tools (network tab),

<%
response.ContentType = "text/html;charset=UTF-8"
%>

Results in a HTML header for Content-Type of:

text/html;charset=UTF-8

Whereas, setting it at the MIME level on IIS7 does not - i'll update my answer when i figure out why.

EDIT 2: I cant get the global MIME approach to work on my test rig - sorry! There are hints of this online: http://forums.iis.net/p/1166956/1941076.aspx#1941076

I'm guessing you'll just have to pop the response.ContentType = "text/html;charset=UTF-8" in an <!-- #include file="..\includes\common.asp" --> type include (or similar).