在经典 ASP 中使用 WinHttpRequest.ResponseStream(与 IStream 相关)?

发布于 2024-12-19 05:13:11 字数 1891 浏览 2 评论 0原文

有没有办法使用 ResponseStream 属性 rel="nofollow">WinHttp.WinHttpRequest.5.1 在 VBScript/ASP 中?至少有 IStream 接口( ResponseStream相关)在一定程度上集成到ASP中。

或者这是您在脚本中可以实现的限制?如果您想更进一步,需要您推出自己的 COM 组件吗?

<html><body><h1>WinHttp</h1>
<%
Dim req, url, o
Set req = CreateObject( "WinHttp.WinHttpRequest.5.1" )
url = "http://www.google.de"
req.Open "GET", url, False
req.Send
Response.Write "<p>Hier kommt <code>" & url & "</code> :</p>"
Response.Write "<pre>"
Response.Write req.Status & " " & req.StatusText & VbNewLine
Response.Write req.GetAllResponseHeaders
Response.Write "</pre>"
' Response.Write Mid( req.ResponseText, InStr( req.ResponseText, "<div" ) )

' Set o = req.ResponseStream
' o = req.ResponseStream
' Same result for Write and BinaryWrite:
' VarType = 13, TypeName = Unknown
' ASP 0106 : 80020005; Typkonflikt; Unbehandelter Datentyp
' o = req.ResponseStream

' o = req.ResponseBody ' mit BinaryWrite
o = req.ResponseText ' mit Write
Response.Write "<p><code>IsObject " & IsObject(o)  & "</code></p>"
Response.Write "<p><code>IsNull "   & IsNull(o)    & "</code></p>"
Response.Write "<p><code>VarType "  & VarType(o)
Response.Write                  " " & TypeName(o)  & "</code></p>"
Response.Write o
' Response.BinaryWrite o
%>

请注意,我知道我可以使用 req.ResponseTextreq.ResponseBody。感兴趣的是知道您是否可以使用仅针对 C 记录但也许(推测)脚本可访问的内容来进一步编写脚本。我对COM一无所知。

Is there a way to work with the ResponseStream property of WinHttp.WinHttpRequest.5.1 in VBScript/ASP? At least the IStream interface (to which ResponseStream is related) is integrated into ASP to a certain degree.

Or is that the limit of what you can achieve in script? Requiring you to roll your own COM component if you want to go any further?

<html><body><h1>WinHttp</h1>
<%
Dim req, url, o
Set req = CreateObject( "WinHttp.WinHttpRequest.5.1" )
url = "http://www.google.de"
req.Open "GET", url, False
req.Send
Response.Write "<p>Hier kommt <code>" & url & "</code> :</p>"
Response.Write "<pre>"
Response.Write req.Status & " " & req.StatusText & VbNewLine
Response.Write req.GetAllResponseHeaders
Response.Write "</pre>"
' Response.Write Mid( req.ResponseText, InStr( req.ResponseText, "<div" ) )

' Set o = req.ResponseStream
' o = req.ResponseStream
' Same result for Write and BinaryWrite:
' VarType = 13, TypeName = Unknown
' ASP 0106 : 80020005; Typkonflikt; Unbehandelter Datentyp
' o = req.ResponseStream

' o = req.ResponseBody ' mit BinaryWrite
o = req.ResponseText ' mit Write
Response.Write "<p><code>IsObject " & IsObject(o)  & "</code></p>"
Response.Write "<p><code>IsNull "   & IsNull(o)    & "</code></p>"
Response.Write "<p><code>VarType "  & VarType(o)
Response.Write                  " " & TypeName(o)  & "</code></p>"
Response.Write o
' Response.BinaryWrite o
%>

Note that I know I can use either req.ResponseText or req.ResponseBody. The interest is in knowing whether you can go further in script using stuff that's only documented for C but maybe (speculating) accessible to script. I'm not knowledgeable about COM.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦明 2024-12-26 05:13:11

您无法直接在脚本代码中对 IStream 执行任何操作。您所能做的就是将其传递给可能使用它的 COM 对象。

IStream 与 Vbscript 非常陌生,即使在 VB6 中,也必须跳过一些困难才能使用它。

There is nothing you can do with an IStream directly in script code. All you could do is pass it to a COM object that might use it.

The IStream is very alien to Vbscript even in VB6 one has to jump through some fiery hoops to work with it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文