Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home Tips And Tricks Add Mime Type (.FLV, MP4) To Web.Config In IIS 7

Add Mime Type (.FLV, MP4) To Web.Config In IIS 7

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>

<?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.

Jul 30, 2011Hoan Huynh
Find PID (Publisher ID) In Commission JunctionAdd Mime Type (.FLV, .MP4) In IIS For A Website Or Global
You Might Also Like:
  • Add Mime Type (.FLV, .MP4) In IIS For A Website Or Global
  • Get File Mime Type Using PHP
  • Get Or Read AppSettings Item Value From The Web.Config File
  • C# How to Get key/value pairs from app.config and web.config
  • How To Track Website With Multiple Google Analytisc Accounts
  • Google Map Supported Type And Simple Example
  • Facebook Like Button And Recommend Button With fb:like, iframe and html5
  • Jquery checkbox checked
  • Get Image Width Height With JQuery And JavaScript
  • PHP Get Remote File Size And Content Type
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

9 years ago Tips And TricksHow To, IIS, Mime Type, Web.config1,863
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
22,237 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
20,087 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
15,872 views
JQuery Allow only numeric characters or only alphabet characters in textbox
13,343 views
C# Read Json From URL And Parse/Deserialize Json
9,851 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Term Papers – Easy to Take Care of
  • How to Write Term Papers in Online Tutorials
  • How to Plan Writing an Essay
  • How to Apply For a Payday Loan With Bad Credit
  • Statistics For Sale – How To Compose One
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (28)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (123)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development