WinHttp TLS connection in classic asp

℡╲_俬逩灬. 提交于 2019-12-04 05:49:07

问题


I'm trying to send payment data to SagePay and, as they are turning off SSL, it needs to be sent using TLS.

The code I have is as follows:

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

I've been told that adding an option lets you set the protocol used but the only one I've found is:

httpRequest.option(9) = 2720

which allows for TLS and SSL but it can only be TLS, does anyone know what the code needs to be or is there something else I should be doing.


回答1:


Option 9 is WinHttpRequestOption_SecureProtocols which is

SSL 2.0: 0x0008
SSL 3.0: 0x0020
Transport Layer Security (TLS) 1.0: 0x0080

So

httpRequest.option(9) = &H80



回答2:


If you are on Windows Server 2003 you may be having the same problem I was having - if you have access to the server, try the answer I added to my own question here: https://stackoverflow.com/a/29140418/1081692 and see how you get on.



来源:https://stackoverflow.com/questions/29098446/winhttp-tls-connection-in-classic-asp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!