IIS6, VBS & XMLHTTP: Execute Access Denied
I've got a VBS file that is pulling XML from our website. It going to run on our local server once it is finished.
Te problem I'm having is that when I run the file on my workstation (Running IIS6 on XP SP3), I get the error:
"Exec开发者_StackOverflowute Access Denied: This Virtual Directory does not allow objects to be executed."
I'm opening the file from my desktop, so I understand there's a security parameter that needs to be changed to allow executables to have access to XMLHTTP. How do I fix this?
Function Get_XML(api_url)
Dim objHTTP, RespText, TempRespText
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.open "Get", api_url, False
objHTTP.setRequestHeader "Content-Type", "text/xml"
objHTTP.send
RespText = objHTTP.ResponseText
'Get_XML = CreateObject("Microsoft.XMLDOM")
'Get_XML.async = False
'Get_XML.loadXML RespText
'For testing:
Get_XML = RespText
Set objHTTP = Nothing
End Function
I found the problem. Apparently the version of VBScript I'm running won't allow the MSXML2.ServerXMLHTTP to run. Not sure if it's the actual version or a security update. So I changed:
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
To:
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
And it runs perfectly.
精彩评论