title: .net mvc 404 Custom Error page only work sometimes
body: <p>I'm trying to make an 404 Action on my MVC 4 site to answer a default Image wherever the site gets a 404 on any image.</p>
  
  <p>Everything WORKS FINE when i run locally, but when i publish my website on my server, it doesn't work...</p>
  
  <p>I have on my Web.Config:</p>
  
  <pre><code>&lt;customErrors mode="On"&gt;
     &lt;error statusCode="404" redirect="~/Home/Error404" /&gt;
  &lt;/customErrors&gt;
  </code></pre>
  
  <p>And on my HomeController:</p>
  
  <pre><code>    public ActionResult Error404()
      {
          if (Request.Url.AbsoluteUri.Contains(".jpg") || Request.Url.AbsoluteUri.Contains(".gif") || Request.Url.AbsoluteUri.Contains(".png"))
          {
              var dir = Server.MapPath("~/Content/Images/");
              var path = Path.Combine(dir, "imageNotFound400.jpg");
              return base.File(path, "image/jpeg");
          }
          return View();
      }
  </code></pre>
  
  <p>As i said, running locally, it Works, and it returns my default image,
  But online, as you can see here:  <a href="http://www.ipgii.org.br/Mensagem?pageSize=9&amp;page=30" rel="nofollow">http://www.ipgii.org.br/Mensagem?pageSize=9&amp;page=30</a>
  and here: <a href="http://www.ipgii.org.br/Content/Uploads/Thumbnails/alegrai-vos-no-senhor.jpg" rel="nofollow">http://www.ipgii.org.br/Content/Uploads/Thumbnails/alegrai-vos-no-senhor.jpg</a>
  it goes to an ugly HTTP 404 error page.</p>
  
  <p>I need help! =]</p>