title: System.Web.HttpException (0x80004005): Maximum request length exceeded
body: <p>I am trying to upload an mp4 video file that is 5.25 MB in size in an ASP.NET MVC 5 application.</p>
  
  <p>I have tried adding this to the Web.config file which has been the accepted answer in most cases to this problem.</p>
  
  <pre><code>&lt;system.web&gt;
      &lt;!-- This will handle requests up to 1024MB (1GB) --&gt;
      &lt;httpRuntime maxRequestLength="1048576" /&gt;
  &lt;/system.web&gt;
  </code></pre>
  
  <p>I've also tried setting the timeout as well in the Web.config</p>
  
  <pre><code>&lt;httpRuntime maxRequestLength="1048576" executionTimeout="3600" /&gt;
  </code></pre>
  
  <p>However, when I go to upload the file I am getting <code>System.Web.HttpException (0x80004005): Maximum request length exceeded.</code></p>
  
  <p>Maybe there is something that needs to be set in the controller or view?</p>
  
  <p>Controller:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Index(HttpPostedFileBase file)
  {
      if (file != null &amp;&amp; file.ContentLength &gt; 0)
      {
          var fileName = Path.GetFileName(file.FileName);
          if (fileName != null)
          {
              var path = Path.Combine(Server.MapPath("~/Content/Videos"), fileName);
              file.SaveAs(path);
          }
      }
      return RedirectToAction("Index");
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>@using (Html.BeginForm("Edit", "Posts", FormMethod.Post, new { enctype =  "multipart/form-data" }))
  {
      &lt;input type="file" name="file" /&gt;
      &lt;input type="submit" value="OK" /&gt;
  }
  </code></pre>
  
  <p>How do you upload video files in ASP.NET MVC 5? </p>