Dim MyArray()
Redim MyArray(5)
Session("StoredArray") = MyArray
用的時候這樣:LocalArray = Session("StoredArray")
LocalArray(1) = " there"
Response.Write(LocalArray(0)&LocalArray(1))
又例如:
<%
'建立並初始化數組
dim myarray()
redim myarray(5)
myarray(0)=" www.ASPprogram.cn"
myarray(1)="這裡是ASP編程網 "
session("storedarray")=myarray
response.redirect("2.ASP")
%>
---2.ASP---
<%
'從session中取出數組的值 並更新第二個元素
localarray=session("storedarray")
localarray(1)="there'printingoutthestringhellothere."
response.write(localarray(0)&localarray(1))
'下面的一行代碼將session中保留的數組更新
session("storedarray")="localarray "
%>