473,324 Members | 2,214 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,324 software developers and data experts.

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 16088
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********@comcast.net> wrote in message
news:ep**************@tk2msftngp13.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.com> 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
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...
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...
0
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...
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...
0
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...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.