Leaving a Page

Discussion in 'ASP .Net' started by brian, Jun 11, 2004.

  1. brian

    brian Guest

    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
     
    brian, Jun 11, 2004
    #1
    1. Advertising

  2. brian

    Patrice Guest

    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" <> a écrit dans le message de
    news:1af2e01c44fb8$6db064f0$...
    > 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
     
    Patrice, Jun 11, 2004
    #2
    1. Advertising

  3. 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!
     
    brian shannon, Jun 11, 2004
    #3
  4. "brian shannon" <> wrote in message
    news:...
    >
    > 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
     
    John Saunders, Jun 11, 2004
    #4
  5. 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.
     
    Justin Beckwith, Jun 12, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rich
    Replies:
    1
    Views:
    405
    bruce barker
    Feb 20, 2004
  2. UJ
    Replies:
    4
    Views:
    2,802
    Curt_C [MVP]
    Aug 10, 2005
  3. Replies:
    7
    Views:
    26,134
    rohit.net100
    Feb 28, 2011
  4. =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=

    Capturing the leaving of a page/http_request

    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=, Nov 17, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    497
    Karl Seguin
    Nov 17, 2005
  5. Arnold Peters
    Replies:
    1
    Views:
    1,590
    Tomer Ben-David
    Oct 27, 2004
Loading...

Share This Page