PC Review


Reply
Thread Tools Rate Thread

Application_OnEnd calls a class but no access to Application object

 
 
GarDavis
Guest
Posts: n/a
 
      8th Aug 2005
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

 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      8th Aug 2005
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




 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
My.Application.Info.ProductName from Application that calls Class Library Pieter Microsoft Dot NET Framework 0 8th Mar 2006 12:23 PM
My.Application.Info.ProductName from Application that calls Class Library Pieter Microsoft Dot NET 0 8th Mar 2006 12:23 PM
My.Application.Info.ProductName from Application that calls Class Library Pieter Microsoft VB .NET 0 8th Mar 2006 12:23 PM
Access Application object from class Cliff Harris Microsoft ASP .NET 4 22nd Apr 2004 05:03 AM
Can't access application object from inside class files trebor@sirius.com.no.more Microsoft ASP .NET 2 1st Jan 2004 07:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:39 PM.