Session variable problems


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Session variable problems

  1. #1
    Nate Guest

    Session variable problems


    I have two ASP pages in my project that are having problems with session variables.

    In Page1.asp I set the session variables when I click a submit button, which
    will also take me to Page2.asp where I use the session variables.

    The first time through everything works great. The session variables have
    values in Page2.asp. Now, while at Page2.asp, I use the browser "Back" button
    to go back to the first page. Again, I click the submit button which will
    take me to Page2.asp. This time when I get to Page2.asp, the session variables
    are empty.

    On the second execution the session variables do have values on Page1.asp.

    Why are the session variables losing their values on Page2.asp?

    TIA
    Nate
    Share on Google+

  2. #2
    Bernd Guest

    Re: Session variable problems


    Hi Nate,

    my first thought is do you initialise your session variables when loading
    your Page1.asp? If you do so set a bit after your first initialisation and
    ask for it the next load.

    something like: if session.initialised = false ...

    Sorry, thatīs all for the moment.

    good luck - Bernd

    "Nate" <nkane@enak.com> wrote:
    >
    >I have two ASP pages in my project that are having problems with session

    variables.
    >
    >In Page1.asp I set the session variables when I click a submit button, which
    >will also take me to Page2.asp where I use the session variables.
    >
    >The first time through everything works great. The session variables have
    >values in Page2.asp. Now, while at Page2.asp, I use the browser "Back" button
    >to go back to the first page. Again, I click the submit button which will
    >take me to Page2.asp. This time when I get to Page2.asp, the session variables
    >are empty.
    >
    >On the second execution the session variables do have values on Page1.asp.
    >
    >Why are the session variables losing their values on Page2.asp?
    >
    >TIA
    >Nate


    Share on Google+

  3. #3
    nick Guest

    Re: Session variable problems


    In case you still don't have an answer...

    You are setting the variables after the user clicks something? Once the page
    is rendered, no more ASP code can be executed Unless I'm missing something,
    it's basically HTML at that point. When you click the button, you should
    be posting to page2 where the session variables can then be set at the top
    of the page... while the page is still processing.

    I would think on your second trip to page1 you are actually setting the variables
    in your 'click' routine for the first time.

    Hope this helps.

    Nick

    "Bernd" <berndlinthe@compuserve.com> wrote:
    >
    >Hi Nate,
    >
    >my first thought is do you initialise your session variables when loading
    >your Page1.asp? If you do so set a bit after your first initialisation and
    >ask for it the next load.
    >
    >something like: if session.initialised = false ...
    >
    >Sorry, thatīs all for the moment.
    >
    >good luck - Bernd
    >
    >"Nate" <nkane@enak.com> wrote:
    >>
    >>I have two ASP pages in my project that are having problems with session

    >variables.
    >>
    >>In Page1.asp I set the session variables when I click a submit button,

    which
    >>will also take me to Page2.asp where I use the session variables.
    >>
    >>The first time through everything works great. The session variables have
    >>values in Page2.asp. Now, while at Page2.asp, I use the browser "Back"

    button
    >>to go back to the first page. Again, I click the submit button which will
    >>take me to Page2.asp. This time when I get to Page2.asp, the session variables
    >>are empty.
    >>
    >>On the second execution the session variables do have values on Page1.asp.
    >>
    >>Why are the session variables losing their values on Page2.asp?
    >>
    >>TIA
    >>Nate

    >


    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center