PDA

View Full Version : Passing ARRAY using Session Variable


raghupathyr
11-28-2002, 12:38 PM
I need to pass an array from one ASP page to another ASP page. For this, I tried using the Session Variable, but it is not working and I'm getting "Internal server error
", can anyone please help me on this.

My code is ...

ASP Page-1
**********
Dim MyArray(x,y)
Session("MySesArr") = MyArray

ASP Page-2
**********
Dim MyArray(x,y)
MyArray = Session("MySesArr")

Roelf
11-28-2002, 12:52 PM
if its a one dimension array, you can always join it to assign it to the session variable, and split it to assign it to the arrayvar in the second page

whammy
11-28-2002, 01:06 PM
Roelf is correct, I'd look up Join() and Split() - a search on google with:

Join() Split() ASP

should return plenty of useful results - by default it uses a comma, but you can use whatever you want like "|".

If you need further help, please post the exact error you're getting (and the relevant code), and we should be able to help. :)

Roelf
11-28-2002, 01:18 PM
btw, dont you have to use the Set keyword to assign an object to a session-variable? Like:
dim MyArray(x,y)
Set Session("MyArrVar") = my Array

whammy
11-28-2002, 01:21 PM
Nope...

Roelf
11-28-2002, 01:22 PM
Ok:o

glenngv
11-29-2002, 08:06 AM
you need the Set keyword if you are creating an object but Array is not an object.

Im not sure if you can assign an array to a session variable but to test if the session variable is an array, you can do like:

response.write(IsArray(Session("MySesArr"))

That will return true or false