I'd like to store the contents of classic ASP pages in a table in a database, and have the ability to dynamically retrieve said contents and execute on the fly. Is this possible?
You can get the text from the database, save it to a temporal .asp file in the website, and then execute a Server.Execute(tempfile). Don't forget to delete the tempfile...
You are probably looking for the "Execute" statement.
Dim aspCode
aspCode = getCodeFromDB() ' I assume you can handle this part
Execute aspCode
This will even work if your db-driven ASP has "Option Explicit" at the very top.
That said, the general idea of having ASP code live inside a database sounds a bit iffy to me, but to each their own, and I wish you luck!
Somebody was able to make the Execute (actually ExecuteGlobal) concept work. I tried using this some years ago as a test and it did indeed work. I believe the real problem would come when you want to debug inside your 1000 line ExecuteGlobal statement.
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=7651&lngWId=4
Basically, the asp text is parsed and items within <%=%> and <% %> are handled appropriately.
For instance
<%=var1 & "-" & var2%>
would convert to
response.write var1 & "-" & var2
and
<%
Hello, this is html
%>
would convert to
response.write "Hello, this is html"