title: IIS7 custom 404 not showing
body: <p>created a new IIS7 web site with Intergrated .net 4.0 app pool.</p>
  
  <p>URLs ending with .aspx do show custom 404 anything else gives the blue server error page
  "HTTP Error 404.0 - Not Found
  The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
  (so nothing to do with IE)</p>
  
  <pre><code>&lt;customErrors redirectMode="ResponseRewrite" mode="On" defaultRedirect="/pages/404.aspx" /&gt;
  &lt;/system.web&gt;
  &lt;system.webServer&gt;
      &lt;httpErrors  &gt;
          &lt;remove statusCode="404" subStatusCode="-1" /&gt;
          &lt;error statusCode="404" prefixLanguageFilePath="" path="/pages/404.aspx" responseMode="ExecuteURL" /&gt;
      &lt;/httpErrors&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>also tried </p>
  
  <pre><code>&lt;httpErrors existingResponse="PassThrough" /&gt;
  </code></pre>
  
  <p>but that just resulted in an empty response.</p>
  
  <p>I have only found one reference to the usefulness of executing the appcmd to test the custom http error handling but here are the results.</p>
  
  <pre><code>C:\Windows\System32\inetsrv&gt;appcmd list config "http://mysite/file.notexist" -section:httpErrors
  
  &lt;system.webServer&gt;
      &lt;httpErrors&gt;
          &lt;error statusCode="401" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
  r" path="401.htm" /&gt;
          &lt;error statusCode="403" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
  r" path="403.htm" /&gt;
          &lt;error statusCode="404" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
  r" path="404.htm" /&gt;
          &lt;error statusCode="405" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
  r" path="405.htm" /&gt;
          &lt;error statusCode="406" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
  r" path="406.htm" /&gt;
          &lt;error statusCode="412" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
  r" path="412.htm" /&gt;
          &lt;error statusCode="500" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
  r" path="500.htm" /&gt;
          &lt;error statusCode="501" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
  r" path="501.htm" /&gt;
          &lt;error statusCode="502" prefixLanguageFilePath="%SystemDrive%\inetpub\custer
  r" path="502.htm" /&gt;
      &lt;/httpErrors&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>which is odd because in iis7 manager the error pages show</p>
  
  <pre><code>404 /pages/404.aspx Execute URL Local
  </code></pre>
  
  <p>.Net Error Pages shows nothing, though I did have an entry in there.</p>
  
  <p>Question 1 : what steps do I need to take for a completely new asp .net 4 iis7 site to have a custom .net error page for every 404 result ?</p>
  
  <p>Question 2 : why does the .net handler work for .aspx files and nothing else ?</p>
  
  <p>note: set the 404 at server level and the appcmd command then showed the custom 404 in the path, but made no difference to the site failing to showing 404.</p>
  
  <p>So I am guessing it's a red herring.</p>