Web app not calling Application_End
-
Hiya I have a normal web app with many forms. My problem is that when I close the web app with the red X in internet explorer, Application_End in Global.asax does not get called to clean up my varibles. Am I doing something wrong?? Thanks
-
Hiya I have a normal web app with many forms. My problem is that when I close the web app with the red X in internet explorer, Application_End in Global.asax does not get called to clean up my varibles. Am I doing something wrong?? Thanks
IrishSonic wrote: Am I doing something wrong?? You dont expect your visitor to shutdown the web site now? :sigh: top secret xacc-ide 0.0.1
-
Hiya I have a normal web app with many forms. My problem is that when I close the web app with the red X in internet explorer, Application_End in Global.asax does not get called to clean up my varibles. Am I doing something wrong?? Thanks
First of all, this question belong in the ASP.NET forum, but since it's a simple question I'll answer it here anyway. The red X in IE (or any browser) does nothing on the server. HTTP is a client-request/server-response mechanism and only client-side scripting events would know that your browser is closing. Also, if you read the documentation for ASP.NET (always a good thing), the
Application_End
handler executes when your ASP.NET web application is shutting down (as leppie tried to point out with little extra helpful information). Each client does not get a separate instance of a web application - that would be stupid (wouldn't scale well, among many other things). Each additional client gets a separate context (a thread), optionally with a session attached. If you want to store information per-client and clean it up, use theSession
property found on many objects (likeHttpContext
,Page
, et. al.) and handle clean-up in theSession_End
handler in Global.asax. This still won't fire when a user closes the browser, however. It will fire when the session is destroyed. The default is in 30 minutes. Please direct future questions to the appropriate forums. This is an ASP.NET related question - it doesn't matter if you wrote it in C# or not; C# is just one many languages that target and use the .NET Framework.Microsoft MVP, Visual C# My Articles