473,240 Members | 1,589 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,240 software developers and data experts.

Question on Control.Unload event

Hello,

I've an application where all my pages implement a PAGE_CODE string
property, this property is stored in HttpContext.Current.Items.

In some page, I must persist data in session while the user perform
operation on this page (postback navigation based). I also need to
clean up the session data when the user leave the page (by a anyway).

My question is about the Unload event, is it safe to use the unload
event and check if the PAGE_CODE is out of scope to remove session
variables that are used in the unloaded page?

I ask this because after some tests, it happen that unload is trigged
on the next navigation within the same session and I can't find any
clear description on when this event will be trigged on the server side.

Either way, what is your strategy to remove unneeded variables in
session? Does anyone allready use the Unload event?

Thanks for your insight.

Gauthier
Nov 19 '05 #1
3 3189
the Unload for triggered as the last event during the page execution.
Page_Unload is the counterpart to Page_Init .. That also implies, for each
post back the unload events for control and page are being executed.

I doubt if I understand the requirement correctly.. if you are looking for a
way to find if the user is done with a page and is navigating to another page
, there is no event supported for that.. Unloading of a page doesn't happen
when user close the browser or navigate to a different page.

Unload event is good for cleaning up resources used during the page
execution.

"Gauthier Segay" wrote:
Hello,

I've an application where all my pages implement a PAGE_CODE string
property, this property is stored in HttpContext.Current.Items.

In some page, I must persist data in session while the user perform
operation on this page (postback navigation based). I also need to
clean up the session data when the user leave the page (by a anyway).

My question is about the Unload event, is it safe to use the unload
event and check if the PAGE_CODE is out of scope to remove session
variables that are used in the unloaded page?

I ask this because after some tests, it happen that unload is trigged
on the next navigation within the same session and I can't find any
clear description on when this event will be trigged on the server side.

Either way, what is your strategy to remove unneeded variables in
session? Does anyone allready use the Unload event?

Thanks for your insight.

Gauthier

Nov 19 '05 #2
Hello,

thanks for your answer,

I'm not trying to do anything when the user close his browser window,
I'm trying to determinate when the unload event is really trigged and
if it's reliable to use it the way I described.

I'm unsure that the Unload event is trigged at the end of the request,
because in development environment, when I put breakpoint in this event
handler, it's not getting called after the request was sent to the
client browser, but it's effectively trigged on the subsequent request.

I suppose I should investigate another way to maintain/clean session
variables but the fact that the unload event seemed to be trigged on
next postback would have helped because only the page I came from
really knows which session variables have to be removed.

Do you use reliably the Unload event and did it fires just after the
request was sent or on the subsequent postback?

Regards,

Gauthier

Sreejith Ram wrote:
the Unload for triggered as the last event during the page execution.
Page_Unload is the counterpart to Page_Init .. That also implies, for
each post back the unload events for control and page are being
executed.

I doubt if I understand the requirement correctly.. if you are
looking for a way to find if the user is done with a page and is
navigating to another page , there is no event supported for that..
Unloading of a page doesn't happen when user close the browser or
navigate to a different page.

Unload event is good for cleaning up resources used during the page
execution.

"Gauthier Segay" wrote:
Hello,

I've an application where all my pages implement a PAGE_CODE string
property, this property is stored in HttpContext.Current.Items.

In some page, I must persist data in session while the user perform
operation on this page (postback navigation based). I also need to
clean up the session data when the user leave the page (by a
anyway).

My question is about the Unload event, is it safe to use the unload
event and check if the PAGE_CODE is out of scope to remove session
variables that are used in the unloaded page?

I ask this because after some tests, it happen that unload is
trigged on the next navigation within the same session and I can't
find any clear description on when this event will be trigged on
the server side.

Either way, what is your strategy to remove unneeded variables in
session? Does anyone allready use the Unload event?

Thanks for your insight.

Gauthier


Nov 19 '05 #3
A project I worked last year, used custom session management. I think, the
code was written in Page_Unload (of the base page) to write the changes made
to session values to the database. Do not have access to the code to
verify.. I may have used the Dispose . Have you tried 'Dispose' ?

http://msdn.microsoft.com/library/de...nlifecycle.asp
"Gauthier Segay" wrote:
Hello,

thanks for your answer,

I'm not trying to do anything when the user close his browser window,
I'm trying to determinate when the unload event is really trigged and
if it's reliable to use it the way I described.

I'm unsure that the Unload event is trigged at the end of the request,
because in development environment, when I put breakpoint in this event
handler, it's not getting called after the request was sent to the
client browser, but it's effectively trigged on the subsequent request.

I suppose I should investigate another way to maintain/clean session
variables but the fact that the unload event seemed to be trigged on
next postback would have helped because only the page I came from
really knows which session variables have to be removed.

Do you use reliably the Unload event and did it fires just after the
request was sent or on the subsequent postback?

Regards,

Gauthier

Sreejith Ram wrote:
the Unload for triggered as the last event during the page execution.
Page_Unload is the counterpart to Page_Init .. That also implies, for
each post back the unload events for control and page are being
executed.

I doubt if I understand the requirement correctly.. if you are
looking for a way to find if the user is done with a page and is
navigating to another page , there is no event supported for that..
Unloading of a page doesn't happen when user close the browser or
navigate to a different page.

Unload event is good for cleaning up resources used during the page
execution.

"Gauthier Segay" wrote:
Hello,

I've an application where all my pages implement a PAGE_CODE string
property, this property is stored in HttpContext.Current.Items.

In some page, I must persist data in session while the user perform
operation on this page (postback navigation based). I also need to
clean up the session data when the user leave the page (by a
anyway).

My question is about the Unload event, is it safe to use the unload
event and check if the PAGE_CODE is out of scope to remove session
variables that are used in the unloaded page?

I ask this because after some tests, it happen that unload is
trigged on the next navigation within the same session and I can't
find any clear description on when this event will be trigged on
the server side.

Either way, what is your strategy to remove unneeded variables in
session? Does anyone allready use the Unload event?

Thanks for your insight.

Gauthier


Nov 19 '05 #4

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

Similar topics

1
by: mjcast | last post by:
I have been working on an ActiveX control in C#. It is packaged in a Windows Control library and the code is in a user control. The control is used as an automation receiver that is used to update a...
6
by: David Sullivan | last post by:
Hi I have a problem with a database where certain users are closing access (by clicking on the X in top right-hand corner) instead of using a command button before they fill in all relevant...
1
by: hal | last post by:
I have an application that includes an activex component that consumes resources that must be released when the a page is unloaded. Toward this end I subscribe to the unload event of the body...
1
by: Hal | last post by:
My most sincere gratitude to anyone who can help me work around this! I have work that needs to be done in javascript on the client whenever a page is unloaded. To this end, I subscribe to...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
0
by: bburkhart | last post by:
I am running into a issue catching a thrown error in the Control.Unload event. Is it possible to throw an Application error from the Unload event and have the global.asax Application_Error catch it?...
6
by: Shimon Sim | last post by:
I have Panel control on the page. I am handling Init event for it. It doesn't seem to fire at all. Why? Thank you Shimon.
13
by: PW | last post by:
Hi, This is bizarre. I've check and rechecked the spelling, cut and paste the name of the form (when trying to rename the form) and the control yet I still get a parameter prompt when the form...
2
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I have a web app that when I click a menu, I load a control. On one of these controls, I have a button that when clicked, I need to unload the control to unload itself and load a different control...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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...

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.