经典asp中的WinHttp TLS连接

时间:2015-03-17 11:55:22

标签: ssl asp-classic sagepay winhttp

我尝试将付款数据发送给SagePay,因为他们关闭了SSL,需要使用TLS发送。

我的代码如下:

set httpRequest = Server.CreateObject("WinHttp.WinHttprequest.5.1")
httpRequest.Open "POST", CStr(strPurchaseURL), false
httpRequest.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
httpRequest.send strPost
strResponse = httpRequest.responseText

我被告知添加一个选项可让您设置使用的协议,但我发现的唯一一个是

httpRequest.option(9) = 2720

允许TLS和SSL,但它只能是TLS,有没有人知道代码需要什么,或者我还应该做些什么。

2 个答案:

答案 0 :(得分:0)

选项9WinHttpRequestOption_SecureProtocols

  

SSL 2.0:0x0008
    SSL 3.0:0x0020
    传输层安全性(TLS)1.0:0x0080

所以

httpRequest.option(9) = &H80

答案 1 :(得分:0)

如果您使用的是Windows Server 2003,则可能遇到了同样的问题 - 如果您有权访问服务器,请尝试我在此处添加的答案:https://stackoverflow.com/a/29140418/1081692并查看您是如何获得的上。