By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,718 Members | 1,840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,718 IT Pros & Developers. It's quick & easy.

Application_OnEnd calls a class but no access to Application object

P: n/a
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

Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
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


Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.