|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I wanna develop a asp page to store some filepath string in the array of string,but i don't know how to save the array into the session,and how to read out it from the session?...Any body can tell & help me??..
![]()
__________________
Being a Code Headman !
|
|
#2
|
|||
|
|||
|
as you store any other session variable. there is no much difference in using an array as a session variable.
just do dim arr(0,2) arr(0,0)=1 arr(0,1)=2 session("arr")=arr Response.Write "session array is " & session("arr")(0,0) & "<br>"
__________________
If you ask a question you are a fool for a second. But if you dont ask, you are a fool for a life time. |
|
#3
|
|||
|
|||
|
Thx very much for aspman!This reply is important for my devlope.
|
|
#4
|
|||
|
|||
|
You said:
======= Response.Write "session array is " & session("arr")(0,0) & "<br>" ======= Can I use a variable to store the session array?, I tried it but not working, any idea? what I tried to do: - I make an array in 1st html and put them into session - I open 2nd page (through submit declaration or HREF), and want to retrieve that 1st stored session 1st HTML ======= dim arr(0,2) arr(0,0)=1 arr(0,1)=2 Session("array") = arr 2nd HTML ======= dim arr2(0,2) arr2 = Session("array") so that I will be able to response.write(arr2(0,1)) instead of Session("array")(0,1) Do you get what my idea is?, any idea to work them out? thank you |
|
#5
|
|||
|
|||
|
televisi!U can't assign array variable to another array variable..U can assign each member of a array variable to the memer of another array!
Like it: for i=0 to 2 arr(0,i)=session("array")(0,i) next |
|
#6
|
|||
|
|||
|
thank you very much
|
|
#7
|
|||
|
|||
|
I don't have any problems assigning an array to a different array in IIS5.1 on XP Pro
The following test code works fine on my box, with arr2 being a clone of arr1 when done. Code:
<% Dim arr1(1,1) Dim arr2 arr1(0,0) = "test1 0,0" arr1(0,1) = 4 arr1(1,0) = "test1 1,0" arr1(1,1) = 8 ' arr2 = arr1 %> |
|
#8
|
|||
|
|||
|
Oh!Doug G,his problem is assign a array from a session array object(not a array).Maybe u don't understand his problem.
|
|
#9
|
|||
|
|||
|
There is no problem storing an array in a session and assigning the array to a new local variable copy on another page in the same session.
televisi, the only thing I see in your code that may be causing you a problem is in the 2nd page where you dim the arr2 dim arr2(0,2) Try just dim arr2 There is no need to iterate through the array elements to copy an array out of a session variable to a local variable. |
|
#10
|
|||
|
|||
|
THx Doug G!But can u tell me some thing about your way or viewpoint..
|
|
#11
|
|||
|
|||
|
I don't think much has changed with asp.NET but I'm using asp3
Session is basically a collection object capable of storing any datatype or object at any named node. So if you have a local array variable, you can simply use Session("theArray") = localArray to store the array in the session object. Then on any subsequent page in the same application with the same Session, you can simply use localArray2 = Session("theArray") to copy the previously stored array to a new local variable. I don't ever try to reference a single array node in an array stored in a session myself, I will always copy the array to a local variable before working with it. |
|
#12
|
|||
|
|||
|
Thx for your detailed introduce!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Any body can tell me how to use array in the session? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|