How to debug the ASP.Net application shutdown code (Application_End application event)
By George Mihaescu
Summary: This article is a quick tip, describing a simple way to debug the code executed when an ASP.Net application is shut down, such as the Application_End event handler. The tip works only in .Net 2.0.
The problem: You have code executed when the application is shut down (such you’ve handled the Application_End event in Global.asax). You want to be able to set a breakpoint in that code and hit it.
The solution: The simplest solution I’ve found relies on the fact that starting with ASP.Net 2.0 the app domain is recycled when a subdirectory of the web application is renamed. Therefore: