After thinking it was impossible to include .asp pages dynamically, I've managed to crack a way of doing it (this may be well known, but I thought it was good anyway!)
On the main page you wish to view, use the function
Server.Execute "Folder/"&Variable&".asp"
This will include the relevant file.
On the page you are including, if you wish to execute asp within it, you can use the following method under some circumstances:
Make sure that the variable is taken to the main page in a query string, ie the address off the main page will be in the format mainpage.asp?my_var=<%=my_var%>
On the included page, use
QueryString = Request.ServerVariables("QUERY_STRING"
This takes the variables from the url of the main page (eg my_var=<%=my_var%> in the above example). You can then chop this up so that the particular variable you want is taken for use in the include page (eg my_var).
In short:
MAIN-------------------------------
mainpage.asp?my_var=<%=my_var%>
Server.Execute "Folder/"&Variable&".asp"
INCLUDE----------------------------
QueryString = Request.ServerVariables("QUERY_STRING"
Cut = split(QueryString,"="
Paste = ubound(Cut) - lbound(Cut) + 1
my_var = (Cut(Paste-1))
On the main page you wish to view, use the function
Server.Execute "Folder/"&Variable&".asp"
This will include the relevant file.
On the page you are including, if you wish to execute asp within it, you can use the following method under some circumstances:
Make sure that the variable is taken to the main page in a query string, ie the address off the main page will be in the format mainpage.asp?my_var=<%=my_var%>
On the included page, use
QueryString = Request.ServerVariables("QUERY_STRING"
This takes the variables from the url of the main page (eg my_var=<%=my_var%> in the above example). You can then chop this up so that the particular variable you want is taken for use in the include page (eg my_var).
In short:
MAIN-------------------------------
mainpage.asp?my_var=<%=my_var%>
Server.Execute "Folder/"&Variable&".asp"
INCLUDE----------------------------
QueryString = Request.ServerVariables("QUERY_STRING"
Cut = split(QueryString,"="
Paste = ubound(Cut) - lbound(Cut) + 1
my_var = (Cut(Paste-1))