I've got to check urls to ensure they are real before inserting into a db I'm using the MSXML2.ServerXMLHTTP object, it works when the server address (eg abc.intra.abc.com) is correct but incorrectly returns a 200 status code even when a missing file is appended to the server name (abc.intra.abc.com/missing.asp) the url should result in a 404 - any ideas?
CODE:
on Error resume next
strTestUrl = "
Set objHttpRequest = CreateObject("MSXML2.ServerXMLHTTP"
objHttpRequest.Open "GET", strTestUrl
objHttpRequest.Send
if(Err.Number <> 0)then
Response.Write "url problem"
else
Response.Write objHttpRequest.Status
end if
Select Case objHttpRequest.Status
Case 200 'No problem!
Response.Write strTestUrl & " is a valid, available URL"
Case 404 'Not found
Response.Write strTestUrl & " could not be found (404 Error)"
Case Else 'Some other problem
Response.Write "An unexpected HTTP Status value was returned: " & .Status
End Select
Set objHttpRequest = Nothing
Any help much appreciated
CODE:
on Error resume next
strTestUrl = "
Set objHttpRequest = CreateObject("MSXML2.ServerXMLHTTP"
objHttpRequest.Open "GET", strTestUrl
objHttpRequest.Send
if(Err.Number <> 0)then
Response.Write "url problem"
else
Response.Write objHttpRequest.Status
end if
Select Case objHttpRequest.Status
Case 200 'No problem!
Response.Write strTestUrl & " is a valid, available URL"
Case 404 'Not found
Response.Write strTestUrl & " could not be found (404 Error)"
Case Else 'Some other problem
Response.Write "An unexpected HTTP Status value was returned: " & .Status
End Select
Set objHttpRequest = Nothing
Any help much appreciated