开发者

Can't set Response object in ASP Classic

开发者 https://www.devze.com 2023-01-08 20:30 出处:网络
This line: set Response = nothing Fails with the error \"Microsoft VBScript runtime开发者_JS百科error \'800a01b6\'

This line:

set Response = nothing

Fails with the error

"Microsoft VBScript runtime开发者_JS百科  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.

EDIT: Here is an example of what I'd like to do with this.

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


You can't set the Response to nothing.

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


Well, I found the answer here: http://blogs.msdn.com/b/ericlippert/archive/2003/10/20/53248.aspx

So we special-cased VBScript so that it detects when it is compiling code that contains a call to Response.Write and there is a named item in the global namespace called Response that implements IResponse::Write. We generate an efficient early-bound call for this situation only.

0

精彩评论

暂无评论...
验证码 换一张
取 消