473,785 Members | 2,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Global.asax and Application_End

Hi,
I'm having difficulty understanding how the Application_End event in the
Global.asax file gets called. I thought that it's called when the specific
web site is stopped via the IIS management console. Could anyone please tell
me where I can dispose of objects when wanting to stop a specific web site
without having to explicitly run IISRESET, as I have other web sites that I
am not allowed to reset on the same machine and calling IISRESET will reset
them.
Thanks you.
Regards,
Craig
Nov 17 '05 #1
2 7704
If the lifetime of the object is that of the application's lifetime, then you don't need to call dispose as the framework will
invoke the finalizers for these objects before the AppDomain is unloaded. In other words, if the app is ending then you don't have
to clean up managed resources. They are managed, and the framework does it for you.

Unless it's a custom object that needs to release unmanaged resources. Then you can do this in the Application_End event as you've
specified.

If the lifetime of the object is that of a user's session, Session_End should be used to dispose of the object. I'm not sure, but
I'd imagine that if the application is ending, all sessions will have time to cleanup via the Session_End event as well but this is
just an assumption
--
Dave Sexton
dave@www..jwaon line..com
-----------------------------------------------------------------------
"Craig" <mc******@mtn.c o.za> wrote in message news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi,
I'm having difficulty understanding how the Application_End event in the Global.asax file gets called. I thought that it's called
when the specific web site is stopped via the IIS management console. Could anyone please tell me where I can dispose of objects
when wanting to stop a specific web site without having to explicitly run IISRESET, as I have other web sites that I am not
allowed to reset on the same machine and calling IISRESET will reset them.
Thanks you.
Regards,
Craig

Nov 17 '05 #2
Another option is to write some code to recycle the application pool that
the application is running in. That gives you the desired effect you are
looking for without messing with the server life itself. You can find code
to recycle the app pool on MSDN

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

"Craig" <mc******@mtn.c o.za> wrote in message
news:#q******** ******@TK2MSFTN GP14.phx.gbl...
Hi,
I'm having difficulty understanding how the Application_End event in the
Global.asax file gets called. I thought that it's called when the specific
web site is stopped via the IIS management console. Could anyone please tell me where I can dispose of objects when wanting to stop a specific web site
without having to explicitly run IISRESET, as I have other web sites that I am not allowed to reset on the same machine and calling IISRESET will reset them.
Thanks you.
Regards,
Craig

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
16127
by: Jim Owen | last post by:
My .Net book states that the Application_End event handler in Global.asax gets called typically about 20 minutes after the last HTTP request. My question is: what is the best way to debug my Application_End code? I could of course add a button or something to a form to run the code explicitly, but I want to be sure it is really getting called after 20 minutes. I assume that if I put a breakpoint in my Application_End code, and then run the...
6
3633
by: Andrea Williams | last post by:
Where is the best place to put global variables. In traditional ASP I used to put all of them into an include file and include it in every page. Will the Global.aspx.cs do that same thing? Thanks in Advance! Andrea
2
3530
by: PRTC | last post by:
I'm trying to use the global.asax in my new web aplication proyect using the Application start to store my connection string GLOBAL.ASAX.vb Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Dim objConnection As OleDbConnection Dim daContent As OleDbDataAdapter Dim objDataReader As OleDbDataReader
9
2390
by: tshad | last post by:
I have an example I copied from "programming asp.net" (o'reilly) and can't seem to get the Sub (writefile) to execute. It displays all the response.write lines that are called directly, but not any of the response.write lines from inside the sub. ******************************************* <%@ Application Language="VB" %> <script runat="server">
4
3050
by: J-T | last post by:
I have my applciation installed in an appplication pool (a worker process) -IIS 6.0-which is defined to be shut down after 20 minutes of being idle.If I put a breakpoint in Application_End method of Global.asax and there is no request for 20 minutes ,dose the breakpoint works for me? Is there a document which can gives me more infomration in this behaviour? Thanks
1
2298
by: PadovaBoy | last post by:
Hi! I try to develop a simple system for monitoring a sub directory of a web site and remake an xml file every time a sub-dir change it's name. I don't wont to use a window.service because, i want to use the same system in many web-site. I have just write some line of code...but i have a problem: when i change the name of a file..i fire-up the Application_end events .... why? how i can meange the event of the filesystemwatcher?
19
10215
by: furiousmojo | last post by:
This is a strange problem. I have a project where the contents of global.asax application_error are not firing. It is an asp.net 2.0 application using web application projects. I have another app using web application projects and it's firing fine but it was upgraded from the 1.1 framework. Why doesn't my global.asax application_error routine fire?
1
1925
by: sai | last post by:
hi all, i have writen the following code in global.asax events and i have kept break points on following events to trace. protected void Session_Start(Object sender, EventArgs e) { Response.Write("Session_Start"); Response.Write("\n");
3
3279
by: Jack | last post by:
Hello, I am trying to add how many users online to my website. I have setup a Global.asax and need some morehelp. I have the following Global.asax Public Class Global Inherits System.Web.HttpApplication
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9947
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4046
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 we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.