473,322 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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 7676
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..jwaonline..com
-----------------------------------------------------------------------
"Craig" <mc******@mtn.co.za> wrote in message news:%2****************@TK2MSFTNGP14.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.co.za> wrote in message
news:#q**************@TK2MSFTNGP14.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
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...
6
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? ...
2
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,...
9
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...
4
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...
1
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...
19
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...
1
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) { ...
3
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.