Without adding video mime types, ex: .mp4, .flv, etc, your video player may not be played. If you own a dedicated server or VPS (Virtual Private Server), you can easy add mime type mappings in IIS but if you’re on a shared hosting environment, you may have to send a new ticket to technical support team of your hosting provider and wait for their reply.
Fortunately, we can proactive add mime types by modifying your web.config. This way can work well on IIS 7 and above, I’m not sure if it works on lower IIS version such as IIS 6.
Add Mime Types To Web.config In IIS 7
<?xml version="1.0"?> <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in \Windows\Microsoft.Net\Framework\v2.x\Config --> <configuration> <system.webServer> <staticContent> <mimeMap fileExtension=".mp4" mimeType="video/mp4" /> <mimeMap fileExtension=".flv" mimeType="video/x-flv" /> </staticContent> </system.webServer> <appSettings/> <connectionStrings/> <system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="false" /> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows" /> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> </system.web> </configuration> |
Let’s open (or create if it isn’t existed) your web.config then modify it just like an example above.
Note: whenever you update the web.config file, your web site will be restarted and all current sessions will be cleared.
Bonus: if you are a member of the Administrators group on the local computer you may need to know How to add MIME Types in IIS.