If you store just single values in Session state, your code will work fine.
However, when you insert an array, the additional code block sees that it is an array, and performs some additional tasks on it. Personally, I don't think this code will run fine. AFAIK
, you cannot directly retrieve elements from an array in Session state. You'll need to "materialize" it in the page as a local variable, and then loop through its items. I believe the following is a better solution to display both string items as arrays from Session state:
Session("Test") = "Test Value"
anArray(0) = "Item 1"
anArray(1) = "Item 2"
anArray(2) = "Item 3"
Session("MyArray") = anArray
'this loop starts the for loop to loop through each item in the collection
For Each item in Session.Contents
'if item is an object then it will say it can't display object
If IsObject(session.contents(item)) then
Response.Write(item & ":Can't display object" & "<br>")
'this is the part i am lost ????
If Isarray(session.Contents(item)) then
localArray = session.Contents(item)
For each myItem in localArray
response.Write "<li>"& myItem
Response.Write(item & " : " & session.Contents(item) & "<br>")
Everyone is unique, except for me.