Routing Unhandled Exceptions

Topics: Web Client Software Factory, User Forum
Jun 18, 2008 at 5:58 PM

We have disparate project teams and have created separate solution folders to manage modules. Each team has jurisdiction over the projects in their given module folder. Additionally, we have opted for using sub web applications so that each team has a distinct web application project that sits under the root web application. We have a need to log exceptions to distinct event sources in the Windows event log depending on which sub web application logs the exception. Exceptions caught in a try catch within the respective web projects get logged to the correct event log. We are trying to resolve how we determine which event log source to use when we have unhandled exceptions. To this end, we have created our own Global.asax.cs as follows:

<%@ Application Language="C#" Inherits="Global" %>


class Global : WebClientApplication

void Application_Error(object sender, EventArgs e)
Exception myException = HttpContext.Current.Server.GetLastError();
. . .
. . .


At this point we have a few options for determining how to log the exception to the right event source.
1. Use the Exception.Source and route based on the originating assembly. This is not preferable as the exception could occur in a shared assembly and then you have the same issue. Granted, we could then rely on the stack trace but it doesn't make it easy for the operations folks to filter errors in the production environment to the right team.
2. Use the Request.Path. This gives tells us which sub web application originated the exception and removes ambiguities should the exception originate in a shared assembly.

We're leaning towards using the Request.Path option but would like to know if anyone else in the community has run up against this issue and resolved it in some other more inventive way.