title: Custom 404 page for ASP.net site on IIS7 for non-asp.net URL
body: <p>I have asp.net site with custom 404.htm. 
  It is configured with customErrors section to handle aspx.</p>
  
  <p><code>&lt;customErrors mode="On" defaultRedirect="404.htm"&gt;<br>
                  &lt;error statusCode="403" redirect="404.htm" /&gt;<br>
                  &lt;error statusCode="404" redirect="404.htm" /&gt;<br>
              &lt;/customErrors&gt;<br>
        &lt;system.webServer&gt;<br>
        &lt;httpErrors&gt;<br>
            &lt;error statusCode="404" path="404.htm" /&gt;<br>
            &lt;error statusCode="500" path="404.htm" /&gt;<br>
        &lt;/httpErrors&gt;<br>
  &lt;modules runAllManagedModulesForAllRequests="true"&gt;
  ...<br>
    &lt;/system.webServer&gt;</code>  </p>
  
  <p>It handles wrongname.aspx well. But for non-aspx requests such as wrongname.htm IIS7 still returns generic error message, not my custom. How to force him do that, say, for all errors for this site, including 500? Should I write a module or it is possible declaratively?</p>