dynamically executing classic ASP pages

半世苍凉 提交于 2019-12-25 03:44:31

问题


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?


回答1:


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...




回答2:


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!




回答3:


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"


来源:https://stackoverflow.com/questions/1408418/dynamically-executing-classic-asp-pages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!