title: Exception thrown in executing Custom Errors page
body: <p>I have an MVC4 application, I'm trying to configure a custom error page, however when I force an exception I get the following:</p>
  
  <pre><code>Server Error in '/' Application.
  
  Runtime Error
  
  Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated. 
  </code></pre>
  
  <p>What I've done so far:</p>
  
  <p>First I set the following in the web.config in <code>&lt;system.web&gt;</code>:</p>
  
  <pre><code> &lt;customErrors mode="On" defaultRedirect="Error" /&gt;
  </code></pre>
  
  <p>I've tried <code>Error.aspx</code> and <code>~/Views/Shared/Error.aspx</code> (that's the location of Error.aspx)</p>
  
  <p>Here is Error.aspx:</p>
  
  <pre><code>&lt;%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage&lt;dynamic&gt;" %&gt;
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  &lt;head runat="server"&gt;
      &lt;meta name="viewport" content="width=device-width" /&gt;
      &lt;title&gt;Error1&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div&gt;
          An error occured.
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Registering global filter (in Global.asax):</p>
  
  <pre><code>    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
      {
          filters.Add(new HandleErrorAttribute());
      }
  </code></pre>
  
  <p>So I'm at a loss. How can I debug this?</p>