asp WinHttp.WinHttpRequest对象方法属性事件api

  由于微软对XmlHttp对象进行了一些限制,无法通过XmlHttp对象伪造部分HTTP 头信息,但是WinHttp.WinHttpRequest.5.1是 msxml 4.0 的底层对象,XMLHTTP/ServerXMLHTTP 是在WinHttp.WinHttpRequest.5.1的基础上封装而来,所以WinHttpRequest 的用法与 XmlHttp 大致相同,但是WinHttp.WinHttpRequest.5.1却可以伪造所有http 请求header信息,所以要伪造所有的http响应头时,可以使用它,而不是封装后的XMLHTTP/ServerXMLHTTP对象

WinHttpRequest 对象属性

属性名称 访问类型 说明
Option 读/写 设置或检索一个WinHTTP的选项值,option为数组,示例查看下面
WinHttpRequestOption_UserAgentString = 0
WinHttpRequestOption_URL = 1
WinHttpRequestOption_URLCodePage = 2
WinHttpRequestOption_EscapePercentInURL = 3
WinHttpRequestOption_SslErrorIgnoreFlags = 4
WinHttpRequestOption_SelectCertificate = 5 '13056 = 忽略错误标志
WinHttpRequestOption_EnableRedirects = 6 '为True时,当请求的页面中有跳转时,抓取跳转页面信息.False相反不抓取
WinHttpRequestOption_UrlEscapeDisable = 7
WinHttpRequestOption_UrlEscapeDisableQuery = 8
WinHttpRequestOption_SecureProtocols = 9
WinHttpRequestOption_EnableTracing = 10
WinHttpRequestOption_RevertImpersonationOverSsl = 11
WinHttpRequestOption_EnableHttpsToHttpRedirects = 12
WinHttpRequestOption_EnablePassportAuthentication = 13
WinHttpRequestOption_MaxAutomaticRedirects = 14
WinHttpRequestOption_MaxResponseHeaderSize = 15
WinHttpRequestOption_MaxResponseDrainSize = 16
WinHttpRequestOption_EnableHttp1_1 = 17
WinHttpRequestOption_EnableCertificateRevocationCheck = 18
ResponseBody 只读 检索作为无符号字节数组的响应实体机构
ResponseStream 只读 检索机构作为响应实体的IStream
ResponseText 只读 作为文本检索响应实体机构
Status 只读 从上次检索响应的HTTP状态代码
StatusText 只读 获取HTTP状态的文本

选项值option使用示例

set xhr=Server.CreateObject("WinHttp.WinHttpRequest.5.1")
xhr.option(6)=false'不允许跳转
set xhr=nothing

 

WinHttpRequest 对象方法
 

方法名称 说明
Abort 中止一个WinHTTP的 发送方法。
GetAllResponseHeaders 检索所有的HTTP响应头。
GetResponseHeader 检索HTTP响应头。
Open 打开一个HTTP连接到HTTP资源。
Send 发送一个HTTP请求到HTTP服务器。
SetAutoLogonPolicy 设置当前自动登录策略。
SetClientCertificate 选择一个客户端证书发送到一个安全的超文本传输协议(HTTPS)服务器。
SetCredentials 设置要使用的凭据与HTTP服务器,要么是原籍国或代理服务器。
SetProxy 设置代理服务器信息。
SetRequestHeader 添加,更改或删除一个HTTP请求标头。
SetTimeouts 指定以毫秒为单位,个人的时间超过了一个组件发送/接收操作。
WaitForResponse

指定的等待时间,以秒为一个异步传送方法来完成的值,SetTimeouts。


  WaitForResponse 在使用异步方式发送请求时,可以用这个方法来控制请求的进程,指定的等待时间,以秒为一个异步传送方法来完成的值,SetTimeouts。
  在服务端脚本中,不可以像客户端那样直接使用回调函数来控制异步请求,也没有相应的函数来使用程序休眠一定的时间,因此,为了等待请求返回,我们可以使用这个方法来等待一定时间。

WinHttpRequest事件

事件名称 说明
OnError 当发生一个应用程序运行时错误时发生。
OnResponseDataAvailable 当响应数据可用时发生
OnResponseFinished 响应数据完成时发生。
OnResponseStart 开始收到响应数据时发生。



WinHttpRequest备注

The WinHttpRequest object uses the IErrorInfo interface to provide error data. A description and numerical error value can be obtained with the Err object in Microsoft Visual Basic Scripting Edition (VBScript), and the Error object in Microsoft JScript. The lower 16 bits of an error number correspond to the values found in Error Messages.
注意:对于 Windows XP 和 Windows 2000,请参阅运行时间要求。
 

Requirements

Minimum supported client Windows XP, Windows 2000 Professional with SP3 [desktop apps only]
Minimum supported server Windows Server 2003, Windows 2000 Server with SP3 [desktop apps only]
Redistributable WinHTTP 5.0 and Internet Explorer 5.01 or later on Windows XP and Windows 2000.
IDL HttpRequest.idl
Library Winhttp.lib
DLL Winhttp.dll

来源:http://www.yunsec.net/a/special/wzjs/wzbc/asp/2012/0125/9963.html

加支付宝好友偷能量挖...


评论(0)网络
阅读(1386)喜欢(0)Asp/VBScript