【问题标题】:Run VBscript code that is sent through form POST运行通过表单 POST 发送的 VBscript 代码
【发布时间】:2012-09-17 04:43:00
【问题描述】:

我想要一个经典的 ASP 页面,除了 VBscript 之外,它的工作方式类似于 jsfiddle。换句话说,我需要显示使用 POST 从一个表单传递到页面的 vbscript 代码的输出。

显然,response.write(request.form()) 不起作用,我什至不知道它是否可行。我可以看到脚本如何将表单输入写入单独的 .asp 页面(使用 filesystemobjectwriteline),然后加载该页面,但是有没有更优雅的方法来为每个请求都没有临时页面?

【问题讨论】:

    标签: post asp-classic vbscript


    【解决方案1】:

    您可以使用 execute() 函数执行此操作(不要与 server.execute() 混淆)。

    这是一个例子:

    <%
        if request.QueryString("task") = "execute" then
            Response.Write "Output: <hr />"
            Execute(Request.Form("VbScript"))
            Response.Write "<hr />"
        end if
    %>
    <form action="test.asp?task=execute" method="post">
    <textarea name="VbScript" style="height: 100px">
    x = 4 - 3
    response.write x
    </textarea>
    <input type="submit" value="Execute" />
    </form>
    

    然而,虽然这很有趣,但我想不出安全性不是主要问题的单一用途。

    您实际上授予用户对您服务器的完全访问权限!

    【讨论】:

    • 非常感谢!这是一个内部开发者工具,所以没有风险。
    猜你喜欢
    • 2012-08-21
    • 2017-10-12
    • 2016-03-11
    • 1970-01-01
    • 2015-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-02
    相关资源
    最近更新 更多