dynamically executing classic ASP pages

2019-08-30 10:58发布

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?

标签: asp-classic
3条回答
▲ chillily
2楼-- · 2019-08-30 11:23

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"
查看更多
我命由我不由天
3楼-- · 2019-08-30 11:26

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

查看更多
做个烂人
4楼-- · 2019-08-30 11:27

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!

查看更多
登录 后发表回答