Click to See Complete Forum and Search --> : Session variables


rghthnrblmrc
12-13-2006, 10:39 AM
I am customizing an ASP-based merchant solution for a customer. The people that wrote the cart are unwilling to help much with this aim. I was wondering, simply, if there is a way to write a script which is capable of tracing out all of the fields of the Session object, i.e. I would like to be able to print out all the keys and values of every session variable so that i may discover which are which. Does this make sense? Moreover, is what I am asking about possible in VBScript? I am new to ASP, but I have lots of scripting experience in general. I would appreciate any assistance with this. Thanks in advance.

lmf232s
12-13-2006, 11:04 AM
Response.Write("Session Variables - " & Session.Contents.Count & " Found<br><br>")
Dim item, itemloop
For Each item In Session.Contents
If IsArray(Session(item)) Then
For itemloop = LBound(Session(item)) To UBound(Session(item))
Response.Write(item & " " & itemloop & "<font color=blue>" & Session(item)(itemloop) & "</font><BR>")
Next
Else
Response.Write(item & " " & "<font color=blue>" & Session.Contents(item) & "</font><BR>")
End If
Next

rghthnrblmrc
12-13-2006, 11:31 AM
Thanks

rghthnrblmrc
12-13-2006, 12:11 PM
I have tested this script and it works well — however:

I have discovered that the cart contents are contained within an array called Session("Cart"), which has an LBound of 0 and a UBound of 25. However, if i try to access an element of the array, e.g. Session("Cart")(0), Session("Cart")(1), Session("Cart")(5), Session("Cart")(25), I get an error "Subscript Out of Range: Session(...)" Is this because the array is indexed by a string rather than a number? If so, is there a way of finding out what the indices are? Does this even make sense? Thanks for any assistance with this... i think i am getting closer... 4 a noob.