title: Custom error page is not displaying on IIS7 ASP.NET
body: <p>I want to add custom error pages to my site. Firstly I have created a test web project, added two test pages, publish it to my local IIS and configured the web.config:</p>
  
  <pre><code>&lt;configuration&gt;
  &lt;system.web&gt;
    &lt;compilation targetFramework="4.0" /&gt;
    &lt;customErrors mode="On" defaultRedirect="http://localhost:10000/apperror.aspx"&gt;
      &lt;error statusCode="404" redirect="http://localhost:10000/404.aspx" /&gt;
    &lt;/customErrors&gt;
  &lt;/system.web&gt; 
  </code></pre>
  
  <p></p>
  
  <p>I can browse this pages separately but when I try to access a not found page like:</p>
  
  <blockquote>
    <p><a href="http://localhost:10000/notfound.aspx" rel="nofollow noreferrer">http://localhost:10000/notfound.aspx</a></p>
  </blockquote>
  
  <p>It works perfect and redirects to my error page. But when I try below</p>
  
  <blockquote>
    <p><a href="http://localhost:10000/notfound" rel="nofollow noreferrer">http://localhost:10000/notfound</a></p>
  </blockquote>
  
  <p>IIS is showing his own error page not my custom error pages. I have searched but not found a solution, Could you please help me how can I achieve this?</p>
  
  <p><a href="https://i.stack.imgur.com/6mn7T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6mn7T.png" alt="enter image description here"></a></p>