>Sorry to say but it does not work. Exception handling in Application_Error comes before the error defined in web.config. So we are back to dealing with it in Application_Error.
What do you want to happen? There is no page to display. The page doesn't exist. If there is a 404 error, just redirect to your error page and handle the 404 error however you want in the aspx page.