IIS 5 & IIS 6
Configuration & Scripting
How to set content types in IIS 6 per file extension?
Last post Jul 31, 2017 02:53 AM by Yuk Ding
Jul 26, 2017 08:58 PM|sneaky|LINK
I noticed that all my .aspx pages are coming back as application/xml content
type, but the result is french accented characters are looking weird. I then set on IIS on response headers a content type of text/xml;
charset=utf-8 which fixed the accented character issue but made all other files, even css, js, images, etc... that content type too and that broke pages. Is there a way I can set a content type of text/xml;
charset=utf-8 only on .aspx pages?
Jul 27, 2017 06:34 AM|Yuk Ding|LINK
Yould set the content types in mime type. It could be set by following this link:
In addition, if the aspx can't work correctly, you could follow this link to enable asp.net:
Jul 27, 2017 01:45 PM|sneaky|LINK
What would I set the mime type value to?
I tried .aspx ->
but the content type of the aspx page still comes as
Jul 28, 2017 05:49 AM|Yuk Ding|LINK
Have you tried this code?
Response.ContentType = "text/xml"; //Must be 'text/xml'
Response.ContentEncoding = System.Text.Encoding.UTF8; //We'd like UTF-8
doc.Save(Response.Output); //Save to the text-writer
//using the encoding of the text-writer
//(which comes from response.contentEncoding)
Jul 28, 2017 02:32 PM|sneaky|LINK
But that would be adding it as a hardcode in the aspx file. I have hundreds of aspx file, is there no way to do that in the IIS itself?
Jul 31, 2017 02:53 AM|Yuk Ding|LINK
Mime type is the only place to set charset in IIS. IIS 6 doesn't have URL rewrite module like IIS 7, so we could not create outbound rule to rewrite RESPONSE_CONTENT_TYPE to text/xml. I'm afraid you could not set this in IIS6. I remembered the Mime type
only work for static content, so maybe the content type of dynamic page .aspx could not be set.