Tag Archives: web.config

ResponseEncoding in IIS7 for static html files in web.config

I couldn’t find any way to set ResponseEncoding in IIS7 for static html files in web.config.

The system.web setting using globalization doesn’t seem to fit anywhere in system.webServer like it seems like it should (someone please let me know if there is a way to do that).

Anyway, I did find a way to sort of shove it in there:

<configuration>
  <system .web>
    <!-- not applied to HTML files -->
    <globalization requestEncoding="utf-8"
       responseEncoding="utf-8" />
  </system>
  <system .webServer>
    <staticcontent>
      <!-- This does get applied to HTML files -->
      <mimemap fileExtension="html"
         mimeType="text/html; charset=utf-8" />
    </staticcontent>
  </system>
</configuration>