无法在ASP Classic中设置Response对象 [英] Can't set Response object in ASP Classic

查看:64
本文介绍了无法在ASP Classic中设置Response对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此行:

set Response = nothing

错误失败

"Microsoft VBScript runtime  error '800a01b6'

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

现在,我可以想到许多原因导致引擎可能不想让我做这种看似愚蠢的事情,但是我不确定缺少一种方法会阻止我.

Now, I can think of any number of reasons why the engine might not want to let me do such a seemingly silly thing, but I'm not sure how a missing method could be stopping me.

这是我要处理的示例.

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! '

推荐答案

您不能将Response设置为空.

You can't set the Response to nothing.

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

The ASP Response object is used to send output to the user from the server.

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

What are you trying to do? If you're trying to end the Response to the user, use

Response.End

这篇关于无法在ASP Classic中设置Response对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆