Application_OnEnd calls a class but no access to Application object

  • Thread starter Thread starter GarDavis
  • Start date Start date
G

GarDavis

When the ASP.Net application ends, the Application_OnEnd() method in
Global.asax is called. This method calls a utility in a class library
to dump information about the ending application.

The utility needs access to the application object to iterate through
the keys to log them and their values. Normally, the utility can get to
the application using HttpContext.Current.Appliction but when called
from the Application_OnEnd(), the HttpContext.Current is null.

Is there a good way to get to this object from the class library method
besides passing it from the OnEnd (which does have access to
Appliction)?

BTW, HttpContext.Current does work OK on Application_OnStart() and
everywhere else the utility is called.

Thanks,
Gary
 
HttpContext.Current is non null when there's a executing request. Application_End
is called when the app is shutting down and there is no executing request
at that time. Can't you access the Application object in the Application_End?

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Back
Top