无法在ASP Classic中设置Response对象

时间:2010-07-21 20:36:39

标签: asp-classic

这一行:

set Response = nothing

失败并显示错误

"Microsoft VBScript runtime  error '800a01b6'

Object doesn't support this property or method: 'Response' "

现在,我可以想到为什么引擎可能不想让我做这么看似愚蠢的事情的原因,但我不确定丢失的方法是如何阻止我的。

编辑:这是我想要做的一个例子。

class ResponseBufferEphemeron
    private real_response_
    private buffer_

    private sub class_initialize
        set real_response_ = Response
    end sub

    private sub class_terminate
        set Response = real_response_
    end sub

    public function init (buf)
        set buffer_ = buf
        set init = me
    end function

    public function write (str)
        buffer_.add str
    end function
end class

function output_to (buf)
    set output_to = (new ResponseBufferEphemeron).init(buf)
end function

dim buf: set buf = Str("Block output: ") ' My string class '
with output_to(buf)
    Response.Write "Hello, World!"
end with 

Response.Write buf ' => Block output: Hello, World! '

2 个答案:

答案 0 :(得分:0)

您无法将响应设置为空。

ASP Response对象用于从服务器向用户发送输出。

你想做什么?如果您尝试结束对用户的响应,请使用

Response.End

答案 1 :(得分:0)

嗯,我在这里找到答案:http://blogs.msdn.com/b/ericlippert/archive/2003/10/20/53248.aspx

  

所以我们使用特殊的VBScript,以便它检测何时编译包含对Response.Write的调用的代码,并且名为Response的全局命名空间中有一个名为item的命名项,用于实现{{1} }。我们只为这种情况生成一个有效的早期约束

相关问题