Redirect response output using VBScript in ASP classic

In a simple .asp file, any content outside the tags is <% %>sent directly to the output buffer. In addition, the expression in the tags <%= %>is evaluated and sent to the output buffer.

I want to redirect it so that in some context that I set, the result of these two constructs is instead sent to a buffer that I control. If possible, I would like to be able to do this dynamically so that I can redirect the output to different buffers at runtime.

The problem is open, largely because I will plan what I create around this solution. I could use any method that exists to capture this output. Performance and ease of use are not core considerations.

This is a continuation of this question in which I am trying to find one possible solution that does not work.

+3
source share
4 answers

Essentially, you are trying to rewrite the ISAPI asp.dll filter. If you really wanted to do this, you can try writing a DLL wrapper around asp.dll, which overrides the WriteClient function . It will not be easy and will ask a question about what you are trying to accomplish.

<% %> ( ) , :

<html>
<%=OutputHtml()%>
</html>

, , .

+1

, , :

    <% sub foo %>
            <h1>Hello, World!</h1>
    <% end sub %>

, . GetRef. ; , GetRef . ( , , .)

, . .

+1

, ASP. ISAPI, , , - .
, , , .

+1
source

good for <% =%> you could write your own function:

function [=](val)
    response.write val
    ' do anything you want with val
end function

another thing is impossible to think. but you can use the <% =%> construct for every output you want to redirect ...

-1
source

Source: https://habr.com/ru/post/1756279/


All Articles