Thursday, February 9, 2006

2319.aspx

How to ignore invalid SSL certificates with MSXML

I frequently use VBScript and MSXML for troubleshooting web sites as I can control all the HTTP headers and easily log the returned results without launching a network sniffer. I had a problem earlier with a web site that returned an expired, and therefore, invalid certificate. In Internet Explorer you get a popup dialog where you can tell the browser to ignore the error but MSXML refused to execute my request and returned this error:



msxml4.dll: The date in the certificate is invalid or has expired


The fix is to tell MSXML to ignore errors like this:



Const SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS = 13056
Dim oXMLRequest


Set oXMLRequest = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0");
oXMLRequest.setOption(2) = SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS


Updated: Added error message

No comments:

Post a Comment