Storing Jscript Arrays in a Session Variable

Results 1 to 3 of 3

Thread: Storing Jscript Arrays in a Session Variable

  1. #1
    Robert Jordan Guest

    Default Storing Jscript Arrays in a Session Variable

    Hello, I&#039m trying to store an array in a session variable. It seems to insert fine, however, when I retrieve it, all the elements have the same value. Is there something special that I&#039m doing wrong?&#060;p>Here is a snippet of my code:<BR><BR>if (Session("aryShoppingCart") != null) {<BR>var aryCurrentOrder = Session("aryShoppingCart");<BR>OrderLength = aryCurrentOrder.length;<BR>aryCurrentOrder[OrderLength] = ProductID;<BR>} else {<BR>var aryCurrentOrder = new Array();<BR>aryCurrentOrder[0] = ProductID;<BR>}<BR><BR>If the session doesn&#039t exist, it sets the first array element to the ProductID and later in the script writes the array to the Session variable, like so:<BR><BR>Session("aryShoppingCart") = aryCurrentOrder;<BR><BR>If the session DOES exist, it gives me back the array. I can get the length (as above) and store a new value in the array. However, all the other values in the array are then set to the same value. Why is that? Am I missing some syntax?<BR><BR>I am desperate for help. Please email me direct and CC the message board. I will post any further results to this message board.<BR><BR>Thank you,<BR>Robert Jordan<BR>jordan@cleanerworld.com<BR>http://www.cleanerworld.com/<BR>http://www.furnitureone.com/

  2. #2
    Summer of 66 Guest

    Default RE: Storing Jscript Arrays in a Session Variable

    Bad idea to put an array in a session

  3. #3
    Robert Jordan Guest

    Default Thanks for your speedy response!

    I&#039;ve been waiting and watching this board every day for two years. Finally some has come to me with an answer! All be praised!<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •