After thinking it was impossible to include .asp pages dynamically, I've managed to crack a way of doing it, which although technically not an 'include' method, uses the Server.Execute function to get round the problem as follows:
On the main page you wish to view, use the function
Server.Execute "Folder/"&Variable&".asp"
where you want it to appear - 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).
And there you have it. The variable can now do its job on the included asp page, which sits inside the main asp page. Very simple, but it worked for me!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.