Search code examples
httpsasp-classicxmlhttprequestserverxmlhttp

How to send Http Post request to an external secure https page in Classic ASP?


I can not send http request to an external page starts with https. However I used setOption(2) = 13056 to ignore secutrity errors I receive this error: msxml3.dll error '80072f8f' A security error occurred. I have no access to my server configuration and looking for a programmatic solution.

<%
Dim data, httpRequest, postResponse

data= "a="&request.querystring("a")
Set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP")
httpRequest.setOption(2) = 13056
httpRequest.Open "POST", "https://example.com", False
httpRequest.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"

httpRequest.Send data

postResponse = httpRequest.ResponseText

'Response.Write postResponse ' or do something else with it
%>

Solution

  • I solved my problem by switching from this:

    Set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP")
    

    to this

    Set httpRequest = Server.CreateObject("MSXML2.XMLHTTP.6.0")