I have been working on a Global Error Logging & Handling solution for a web application that is part of a huge system we have been developing in my company.
I used an HttpModule to get attached to the Application_Error event, where I instantiate my own error handler classes and process the error. The processing is done though sending an email to the admin, saving to datatabase, and optionally saving to a text file. After the error handling is finished, I redirect users to "ApplicationName.er".
The "ApplicationName.er", has a weird extension right? I have added this extension to the IIS, so that it will send such requests to my web application. In my web application, I built an HttpHandler, that handles such request or pages with the .er extensions. In the ProcessRequest method of the HttpHandler, I was sending a WebRequest to a template page, that has the text to display when we are faced with an exception in our application. All that was going fine. (I could have also used an HttpHandlerFactory instead).
The problem seemed to be as follows: The whole application is set to be "denied by ?", which means only authenticated users are allowed to visit my web appication pages. The problem with my application was that, in the HttpModule, I was redirecting to ApplicationName.er, since this file doesn't physically exist and I cannot add a <location> tag for this page since, it is not a .NET page and so the location tag won't have any effect on it, for all the above reasons, my application was not running as expected.
Solution? Well, it was an easy yet effective solution, I created a new folder named Include, it is an empty folder. I add a location tag for this folder to be accessible by all users <allow user="*" />. I made the HttpModule redirect to ~/Include/ApplicationName.er and that's it worked perfect.
Hope that helps you,