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

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
Nov 18 '05 #1
4 1191
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" <bs******@lbrspec.com> a écrit dans le message de
news:1a*****************************@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

Nov 18 '05 #2

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!
Nov 18 '05 #3
"brian shannon" <bs******@lbrspec.com> wrote in message
news:e0**************@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
Nov 18 '05 #4
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.
Nov 18 '05 #5

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

Similar topics

1
by: Rich | last post by:
Hello, I want to create a cookie that will expire in a few mintues after a user leaves my page so that they can return without having to login again if they were only gone for a few minutes. I...
3
by: Dag Sunde | last post by:
Both refreshing (by pressing F5 or otherwise) a page, and navigating away from a page leads to onUnload() triggering. Is it possible to determine if the user is leaving the page for another, or...
8
by: Zvonko | last post by:
Hi! Is it possible to capture an event when user leaves the page and execute some code? Not when he closes the window. Any ideas?
1
by: Rich | last post by:
Hello, I want to create a cookie that will expire in a few mintues after a user leaves my page so that they can return without having to login again if they were only gone for a few minutes. I...
2
by: aaron | last post by:
Hi All, I have a custom web control which works perfectly. Its just a tabcontrol to spit out navigation tabs, it inherits from System.Web.UI.WebControls.WebControl In web page design view,...
3
by: Anburaja | last post by:
Hi, I want to get confirmation before leaving a page. If the selects Yes i want to leave the page else i want to retain the page in the browser. i tried with <body onbeforeunload="return...
3
by: =?Utf-8?B?Q2hyaXMgUm9kZW4=?= | last post by:
I am working on an ASP.NET application utilizing .NET 3.5. One page is using a multi-view with 10 views. UpdatePanels are used to navigate from one view to another. There are hundreds of fields and...
5
by: =?Utf-8?B?QW5keQ==?= | last post by:
As per the question really. Not trying to stop them leaving, but just detect WHEN they leave the site
1
by: Anonymous | last post by:
Which is the correct approach to disable buttons when leaving an aspnet page? Currently I have the following html, which disables buttons when pressing F5 in FireFox, which ofcourse can occur...
4
by: daveh551 | last post by:
Okay, I feel like this is probably a stupid question, but... I have accessed sites that are pushing some scam that, when you go to leave the page it will pop up a box saying, "No, don't go, let...
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: 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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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...
0
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...

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.