XMLHTTP object & SSL certificate issue

ztheged used Ask the Experts™
I've got a problem with a function which is used to retrieve a file off a server. The server has SSL encryption, however the certificate is not issues by a "trusted company" - or atleast this is the alert I receive when attempting to manually access the file.

The error I get when trying to execute my script:

msxml3.dll error '80072f0d'

The certificate authority is invalid or incorrect

I've researched the subject and found the XMLHTTP setOption method can override the handling of the certificate issue, but I have not been able to get it working.

The script:

Function GetDBfile( GroupID )

      dim strFcontent
      dim xml, newopt

      set xml= CreateObject("Msxml2.ServerXMLHTTP")
      xml.Open "GET",url,False
      newopt = (xml.getOption(2) - 13056)
      xml.setOption(2) = newopt
      strFContent = xml.ResponseBody
      set xml=Nothing

      With CreateObject("ADODB.Stream")
      .Type = 1
      .Write strFContent
      .SaveToFile Server.MapPath("files/db/"& GroupID &".txt"),2
      End With
      GetDBFile = True

End Function

Any ideas?
Thanks in advance.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

xml.setOption(2) = newopt

should be

xml.setOption 2, newopt


I'm afraid that made no difference. It continues to display

msxml3.dll error '80072f0d'

The certificate authority is invalid or incorrect
According to my MSXML documentation:

"The default value is to ignore all problems. You must set this option before calling the send method."

So in theory that means that commenting out the setOption line should makes things work OK.

But you could try explicitly setting the value to SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS (= 13056):

xml.setOption 2, 13056


Got it fixed. Thanks for the help. Explicitly settings the value did the trick. Based on what I read before, I thought I had the syntax correctly. Seems I still have alot to learn. Thanks for your quick help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial