We are trying to deploy a web application to Windows 2008 server with IIS 7 but are having trouble with error handling because Application_Error in global.asax does not appear to be firing. In our development server the same code is working as we intended.
For testing, we have reduced the code to:
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("http://www.google.com")
End Sub
Web.config contains
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="error/error.aspx"/>
</system.web>
With this being the error handling code, throwing an error on the development machine takes you to google.com. On the production server it takes you to error.aspx. i.e. Application_Error does not appear to be firing. We have checked that global.asax is publishing correctly by updating the Session_Start to include a version number.
Help please, I'm totally stumped!