I have asp.net site with custom 404.htm. It is configured with customErrors section to handle aspx.
<customErrors mode="On" defaultRedirect="404.htm">
<error statusCode="403" redirect="404.htm" />
<error statusCode="404" redirect="404.htm" />
</customErrors>
<system.webServer>
<httpErrors>
<error statusCode="404" path="404.htm" />
<error statusCode="500" path="404.htm" />
</httpErrors>
<modules runAllManagedModulesForAllRequests="true">
...
</system.webServer>
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?