![]() |
Leaving a Page
Is there an event that can be fired when a user navigates
to another page. If a user is at page 'A' and navigates to page 'B' I want code to excute. I am not looking for browser exits. Thanks |
Re: Leaving a Page
Client side you could perhaps use the onunload for the body tag (you won't
distinguish between exit and navigating to another page). It's always better to describe also why you need to do that so that someone can suggest a new direction if possible... -- "brian" <bshannon@lbrspec.com> a écrit dans le message de news:1af2e01c44fb8$6db064f0$a601280a@phx.gbl... > Is there an event that can be fired when a user navigates > to another page. If a user is at page 'A' and navigates > to page 'B' I want code to excute. I am not looking for > browser exits. > > Thanks |
Re: Leaving a Page
Thanks Patrice I have my web.config file set for 20 minute timeouts. I use session variables throughout my page. If I assign a session variable in certain pages I only need that variable for the time that the user is on the page. For instance, I have a dataset stored in a session variable that is only used for 1 page. The user will make numerous postbacks to the page so I don't want to fill the dataset each time. But once the user leaves the page I am done with the dataset so I would like to clear it out of memory immediately. I can't clear the variable because I don't know when the user is done with the page. Is there a better way of storing this dataset? Should I be cacheing it. I have never used cacheing in my apps so maybe I should if it would work better in this type of situition. Thanks *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
Re: Leaving a Page
"brian shannon" <bshannon@lbrspec.com> wrote in message
news:e0c5Gi8TEHA.1652@TK2MSFTNGP09.phx.gbl... > > Thanks Patrice > > I have my web.config file set for 20 minute timeouts. I use session > variables throughout my page. > > If I assign a session variable in certain pages I only need that > variable for the time that the user is on the page. For instance, I > have a dataset stored in a session variable that is only used for 1 > page. The user will make numerous postbacks to the page so I don't want > to fill the dataset each time. > > But once the user leaves the page I am done with the dataset so I would > like to clear it out of memory immediately. I can't clear the variable > because I don't know when the user is done with the page. You will have to decide what constitutes "done". This is a lot easier if your page has something like a "Done" button, whose click event would signal that the user is done. Otherwise, you can find yourself in trouble if the user does something like use the back button or create a second browser window. -- John Saunders johnwsaundersiii at hotmail |
Re: Leaving a Page
One option is to call a new window on page unload, that performs the
Session.Abandon(); <body onunload="window.open('killsession.aspx')"> have killsession.aspx automically kill the session and close itself. |
| All times are GMT. The time now is 10:25 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.