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

Home Posts Topics Members FAQ

Global.asax Application_End questions

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
application from within VS.Net, that 20 minutes later my breakpoint isn't
going to get hit and suddenly I can step through it. Lastly, what the code
does is update the database with the current application cache, and I want
this to happen right afdter I exit the application, not 20 minutes later,
while I'm developing the app, I'm going in and out all the time and 20
minutes won't pass without an HTTP request pretty much all day.

How is this stuff typically handled?

--
- Jim Owen
206-501-6936
Nov 17 '05 #1
3 16127
that's the nature of the beast... you don't know when the
application will end.

You said "when I exit the application" - that event
doesn't happen. you close the browser, but you
don't "Exit" a web application... not unless you have a
button that says "Exit Application" - and of course,
that's silly.

You can either sit in the debugger, waiting for the app to
die, add a button to simulate the event, or just add a
button that calls your end-of-application routines to test
it, then implement the code and all should be A-ok

-----Original Message-----
My .Net book states that the Application_End event handler in Global.asaxgets called typically about 20 minutes after the last HTTP request. Myquestion is: what is the best way to debug my Application_End code? I couldof 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 assumethat if I put a breakpoint in my Application_End code, and then run theapplication from within VS.Net, that 20 minutes later my breakpoint isn'tgoing to get hit and suddenly I can step through it. Lastly, what the codedoes is update the database with the current application cache, and I wantthis to happen right afdter I exit the application, not 20 minutes later,while I'm developing the app, I'm going in and out all the time and 20minutes won't pass without an HTTP request pretty much all day.
How is this stuff typically handled?

--
- Jim Owen
206-501-6936
.

Nov 17 '05 #2
You want the Session_End event, not the Application_End event. The
Session_End Event occurs whenever a single user Session ends. As you pointed
out, in a web site with many users accessing it every day, the
Application_End Event may never fire. In either case you're going to have to
wait. There's no way to force it from the browser side. If the user
navigates away, or closes their browser, the server has no way of knowing
this (HTTP is stateless). When the Session times out, the event will fire.

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Some things just happen.
Everything else occurs.

"Jim Owen" <jk********@com cast.net> wrote in message
news:ep******** ******@tk2msftn gp13.phx.gbl...
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
application from within VS.Net, that 20 minutes later my breakpoint isn't
going to get hit and suddenly I can step through it. Lastly, what the code
does is update the database with the current application cache, and I want
this to happen right afdter I exit the application, not 20 minutes later,
while I'm developing the app, I'm going in and out all the time and 20
minutes won't pass without an HTTP request pretty much all day.

How is this stuff typically handled?

--
- Jim Owen
206-501-6936

Nov 17 '05 #3
Well now I'm quite confused. I have been able to debug my Application_End
code and it works fine. Then just for grins I put a breakpoint in there and
let the browser sit there while I ate lunch, and it never hit my
Application_End code. What am I doing wrong? All I've done is put a call to
a method in the Global.asax file under Application_End .

--
- Jim Owen
206-501-6936
"David Waz.." <dl*@pickpro.co m> wrote in message
news:53******** *************** *****@phx.gbl.. .
that's the nature of the beast... you don't know when the
application will end.

You said "when I exit the application" - that event
doesn't happen. you close the browser, but you
don't "Exit" a web application... not unless you have a
button that says "Exit Application" - and of course,
that's silly.

You can either sit in the debugger, waiting for the app to
die, add a button to simulate the event, or just add a
button that calls your end-of-application routines to test
it, then implement the code and all should be A-ok

-----Original Message-----
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
application from within VS.Net, that 20 minutes later my

breakpoint isn't
going to get hit and suddenly I can step through it.

Lastly, what the code
does is update the database with the current application

cache, and I want
this to happen right afdter I exit the application, not

20 minutes later,
while I'm developing the app, I'm going in and out all

the time and 20
minutes won't pass without an HTTP request pretty much

all day.

How is this stuff typically handled?

--
- Jim Owen
206-501-6936
.

Nov 17 '05 #4

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

Similar topics

2
7704
by: Craig | last post by:
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...
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
0
1302
by: Stonie | last post by:
Hi All, I have an asp.net web application that needs to clean up some worker threads on application shutdown. These threads are emptying an in memory buffer of messages to disk. Basically I want these threads to empty any remaining messages to disk before exiting. To do so, I'm calling a clean up method in Application_End()
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
10319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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...
1
10087
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.