I'm trying to build a webpage in classic ASP to check the status of a series of URLs.
My code is as follows:
Function TestSite(sURL)
UserAgent = "Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1)"
Set poster = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
poster.open "GET", sURL, false
poster.setRequestHeader "User-Agent",UserAgent
poster.send
If poster.status = 200 Then
TestSite = poster.responseText
Else
' ## ERROR ## '
TestSite = ""
End If
Set poster = Nothing
End Function
The URLs are all HTTPS with non-standard port numbers included (eg https://somedomain.com:4433/restofurl)
When I run the urls in a web browser, they load just fine, but when I put them through the above function I get:
A connection with the server could not be established
I've checked my function with the following alternatives: 1) A non secure URL - this works fine 2) A secure URL with no port specified - this works fine 3) A secure URL specifying port 443 - this works fine 4) A secure URL specifying port 443 on the target server - THIS works fine
On the basis of that, I'm as sure as I can be that my code is correct. Does anyone have any suggestions for further troubleshooting?