Hi,
Does anybody know a way to check for broken links within ASP?
I want to be able to check web links across various servers.
I have used this code below and it works fine if the url is within the original domain that the code is run - however if I try another random website it will fail with
msxml3.dll error '800c0005'
The system cannot locate the resource specified.
/pages/links.asp, line 44
Function URLStatus(strURL)
Dim objXMLHTTP, strReturnStatus
Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
'Set oXMLHttp=Server.CreateObject("MSXML2.XMLHTTP")
objXMLHTTP.Open "GET", "http://www.test.co.uk", False
objXMLHTTP.Send
strReturnStatus = objXMLHTTP.Status
Set objXMLHTTP = Nothing
URLStatus = strReturnStatus
End Function
Dim strfrmURL
strfrmURL = CStr("OK")
If strfrmURL <> "" Then
If URLStatus(strfrmURL) = "200" Then
Response.Write "Link is working."
Else
Response.Write "Link is not working: " & URLStatus(strfrmURL)
End If
End If