How to configure a Web.Config file to allow custom 404 handling while still displaying on-page 500 error detail?

Try this -

<configuration>
   <system.webServer>
      <httpErrors errorMode="Custom" defaultResponseMode="File" >
         <remove statusCode="404" />
         <remove statusCode="500" />
         <error statusCode="404" 
            path="404.html" />
         <error statusCode="500" 
            path="500.html" />
       </httpErrors>
   </system.webServer>
</configuration>

The 404 error page is 404.html and it is located in my root, likewise the 500 page


Classic ASP doesn't pass through the error in IIS7 by default. To enable that for a site, run the following from the command line, being sure to replace {sitename} with your name site:

c:\windows\system32\inetsrv\appcmd.exe set config "{sitename}" -section:system.webServer/httpErrors /existingResponse:"PassThrough" /commit:apphost

Additionally, make sure to turn off IIS friendly errors. They really aren't friendly.