title: mvc file upload with httpRuntime maxRequestLength
body: <p>I created mvc project and want to upload the file. I registered in the web.config </p>
  
  <pre><code>&lt;httpRuntime maxRequestLength="2000"/&gt; 
  &lt;customErrors mode="On" redirectMode="ResponseRedirect" defaultRedirect="address here"&gt; &lt;/ customErrors&gt;, in Index.aspx &lt;% using (Html.BeginForm ("upload", "home", FormMethod.Post, 
      new {enctype = "multipart / form-data"})) {%&gt; 
      &lt;label for="file"&gt; Filename: &lt;/ label&gt; 
      &lt;input type="file" name="file" id="file" /&gt; 
  
      &lt;input type="submit" /&gt; 
  &lt;%}%&gt; 
  </code></pre>
  
  <p>In HomeController.cs </p>
  
  <pre><code>[HttpPost] 
  public ActionResult Upload (HttpPostedFileBase file) 
  { 
      if (file! = null &amp; &amp; file.ContentLength&gt; 0) 
      { 
          if (file.ContentLength&gt; 4096000) 
          { 
              return RedirectToAction ("FileTooBig"); 
          } 
          var fileName = Path.GetFileName (file.FileName); 
          var path = Path.Combine (Server.MapPath ("~ / App_Data / uploads"), fileName); 
          file.SaveAs (path); 
      } 
      return RedirectToAction ("Index"); 
  } 
  </code></pre>
  
  <p>If I attach files over 2 megabytes DefaultRedirect works perfectly in Opera, but does not work in Chrome and IE. I also used Response.Redirect ("address here") in Application_Error () event in global.asax. It also does not work in Chrome and IE. What should I do?</p>