有没有办法使用VBScript/ASP 中的ResponseStream
属性?WinHttp.WinHttpRequest.5.1
至少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一无所知。