I implemented an error handling httpmodule similar to the one described here:
If I run the application locally through the Visual Studio Development Server everything works as expected. If I run it through IIS with a wildcard mapping set up in the ISAPI extensions to go to the dotnet dll, and I have the checkbox to "Verify that the file exists" turned off - it works as expected for .aspx files but not for anything else.
In my web.config I have the following:
<customErrors mode="RemoteOnly" defaultRedirect="~/_errors/500-server-er
<error statusCode="403" redirect="~/_errors/403-forbidden.aspx"/
<error statusCode="404" redirect="~/_errors/404-page-not-found.a
<add name="HttpErrorModule" type="tmpw.applicationname.App_Code.Http
And under IIS errors I have it set up so that 404 errors go to the same 404 URL in web.config.
The behavior I am expecting is that if I go to appliationname.com/xyz.html and the page does not exist, it is kicked into the error handling code. The error handling module is set up to log the event and I should get an email. And even failing that the 404 page should still load in IIS settings.
The error handling code does kick in if I go to appliationname.com/xyz.aspx - a page which does not exist. But for any other file extension the 404 processing is handled by IIS. So any error logging I am doing in the HTTPModule is not getting called.
When I run an HTML page it does get processed to some extent. The code I have in Application_BeginRequest in global.asax does get called. But at the end of that block it stops processing.
The application I am working on is a migration of older code. I want to be alerted to every 404 that comes through the application so that I can see if we missed anything. I could potentially get this sort of information from the IIS logs or I could try to move the error logging to the code behind of the error pages instead of the HTTPModule. But I shouldn't have to should I? Why won't it process HTML? And why does it work when when running the application through Visual Studio but bot when I run it through IIS?
Any help would be appreciated.