title: Custom Error Pages with Layout
body: <p>I've been fighting to get custom error pages to work and keep finding my way back to simply using a static page. Though the static page works, it would require remaking the navigation bar which we would like to avoid at this time. I'm currently using the following to specify custom error pages.</p>
  
  <p>Asp.net Error Handling</p>
  
  <pre><code>&lt;customErrors mode="On" redirectMode="ResponseRewrite"&gt;
    &lt;error statusCode="404" redirect="~/404.aspx"/&gt;
  &lt;/customErrors&gt;
  </code></pre>
  
  <p>IIS Error Handling</p>
  
  <pre><code>&lt;httpErrors errorMode="Custom"&gt;
    &lt;remove statusCode="404"/&gt;
    &lt;error statusCode="404" path="/404.html" responseMode="File"/&gt;
  &lt;/httpErrors&gt;
  </code></pre>
  
  <p>Is there a method of implementing dynamic custom error pages that can handle for both IIS errors and Asp.net errors?</p>