How to configure Web.Config for static HTML5 files?

Usually an IIS version 7.5 server, lacks MIME-Type information for file extensions that are more common on the internet today, and by default, files without MIME-Type, are blocked for download, preventing them from being accessed, as if they did not exist on the web server.

When this occurs, you try to download m4v, or mp4, or ogv files, or web-fonts with woff and woff2 extensions, and are considered with error 404 (not found).

With the following file, you will be able to inform IIS that there are extensions that must be sent to the browser, as it adds the MIME-Type information to the files, being delivered without problems to the browser.

Here is an example:

<?xml version="1.0" encoding="utf-8"?>
<remove fileExtension=".mp4" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<remove fileExtension=".m4v" />
<mimeMap fileExtension=".m4v" mimeType="video/m4v" />
<remove fileExtension=".ogg" />
<mimeMap fileExtension=".ogg" mimeType="video/ogg" />
<remove fileExtension=".ogv" />
<mimeMap fileExtension=".ogv" mimeType="video/ogg" />
<remove fileExtension=".webm" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
<remove fileExtension=".oga" />
<mimeMap fileExtension=".oga" mimeType="audio/ogg" />
<remove fileExtension=".spx" />
<mimeMap fileExtension=".spx" mimeType="audio/ogg" />
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<remove fileExtension=".svgz" />
<mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />
<remove fileExtension=".eot" />
<mimeMap fileExtension=".eot" mimeType="application/" />
<remove fileExtension=".otf" />
<mimeMap fileExtension=".otf" mimeType="application/font-otf" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
<remove fileExtension=".cdr" />
<mimeMap fileExtension=".cdr" mimeType="application/cdr" />
<remove fileExtension=".apk" />
<mimeMap fileExtension=".apk" mimeType="application/" />
With this you can download any recent content, based on HTML5, such as videos, fonts, svg, woff and woff2 fonts, and Android apps, with APK extension.

No comments