在经典 ASP 中使用 WinHttpRequest.ResponseStream(与 IStream 相关)?
有没有办法使用 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.ResponseText
或 req.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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法直接在脚本代码中对 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.