473,480 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Application_OnEnd calls a class but no access to Application object

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
1 1355
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1369
by: | last post by:
I still have no clear idea of Application_OnEnd functioning on w2000 both Pro and Server. I have this sub in my global.asa which is supposed to save Application scope variables to a file. (then...
2
2217
by: Victor Fees | last post by:
I have a general question for which I would like to get some general input from the online community. I'm building an asp.net web application that will make extensive use of a SQL Server 2K...
2
1990
by: Edward | last post by:
I'm trying to understand how application_onend event in the global.asax works. I've hear a lot of explanations that this event fires when the HttpApplication shuts down after the last user's...
5
3787
by: RJ | last post by:
I tried using the Application object to store data in some variables, which would be globally accessible within the web service application code. On subsequent web method calls, the Application...
3
2311
by: jlamanna | last post by:
I was wondering if there was a utility that could tell you when your C# application is making cross-apartment COM calls. I have a fairly large application that makes extensive use of a 3rd party...
6
2195
by: Pucca | last post by:
I have a program that originally compiles into a exe file. I changed the compile option to generate dll file. This program calls a com component. Can I use pinvoke in C# to call it? The...
16
8358
by: Paul Schwann | last post by:
Hi group, I am relatively new to C# (although I have a lot of programming excperience in other languages like Java and C). Currently I am searching for a solution to this problem: Suppose you...
11
2203
by: Jay Dee | last post by:
Object garbage collection of events I can not help wondering how the garbage collection system handles events. If I release all references to an object that has a void that an event somewhere...
45
2958
by: =?Utf-8?B?QmV0aA==?= | last post by:
Hello. I'm trying to find another way to share an instance of an object with other classes. I started by passing the instance to the other class's constructor, like this: Friend Class...
0
7033
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6903
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6726
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4468
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2974
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
557
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.