title: ASP.NET / Web.config: customErrors redirect only on a 404
body: <p>I have this scenario:</p>
  <p>A user comes to my site and follows a link, which doesn't exists anymore, he should be redirected to a custom errorpage. (that works)</p>
  <p>If a user does something, that throws an error, he should see the Stacktrace and the real Errorpage.</p>
  <p>This is my current Web.config:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
  &lt;configuration&gt;
      &lt;system.web&gt;
          &lt;customErrors&gt;
            &lt;error statusCode=&quot;404&quot; redirect=&quot;/errors/404.htm&quot; /&gt;
          &lt;/customErrors&gt;
          &lt;compilation debug=&quot;true&quot; strict=&quot;false&quot; explicit=&quot;true&quot; /&gt;
      &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>with this configuration, a 404 will be redirected to the right site, but a HTTP 500 will be shown as following:</p>
  <blockquote>
  <p><strong>Server Error in '/' Application</strong></p>
  <p>Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.</p>
  <p>Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a &quot;web [.config&quot; configuration file located in the root directory of the current web application. This tag should then have its &quot;mode&quot; attribute set to &quot;Off&quot;.</p>
  <p>[...]</p>
  </blockquote>
  <p>But in this case I want to show the stacktrace.</p>
  <p>How can I do this?</p>
  <p><strong>Note:</strong> We're on Linux with a Mono &lt;- FastCGI -&gt; Lighttpd construction.</p>