I have two files. (This is a simplified example)

The first file declared variables - the second outputs the variables.

The problem is that myArray is 'undeclared' when file2.aspx tries to use it. However varName is working fine.

If I declare and populate myArray in the same way in file2.aspx it also works fine.

Can anyone shed any light on the problem?

file1.aspx
Code:
<%
'declare variable
varName = "hello"

'declare array
Dim myArray(2) As String
myArray(0) = "0"
myArray(1) = "1"
myArray(2) = "2"
%>
<!--#include file="file2.aspx"-->
file2.aspx
Code:
<div>
<%  
'output name variable
Response.Write(varName)

'Loop through array and output results.
For i = 0 To 2
    Response.Write(myArray(i))
Next
%>
</div>
Thanks for your help.