Does URL Exist?
Does http://educ.jmu.edu/~johns2ja/BOO.jpg exist?
It exists!
Does http://educ.jmu.edu/~johns2ja/BOOTS.jpg exist?
It does not exist!
Code used:
<%
//
// URL to be checked
//
CheckURL = ("http://educ.jmu.edu/~johns2ja/BOO.jpg")
CheckForURL(CheckURL)
CheckURL = ("http://educ.jmu.edu/~johns2ja/BOOTS.jpg")
CheckForURL(CheckURL)
//
// create an XMLHTTP object that is the vehicle for the page check
//
Sub CheckForURL(myURL)
response.write "<p>Does " & CheckURL & " exist?</p>"
Set GetConnection = CreateObject("Microsoft.XMLHTTP")
//
// open a path to the chosen URL and attempt to send data to it
//
GetConnection.Open "get", CheckURL, False
GetConnection.Send()
//
// check the return code, 200 means OK
//
if GetConnection.status = 200 then
response.write("It exists!")
else
response.write ("It does not exist!")
end if
//
// get rid of the XMLHTTP object
//
Set GetConnection = Nothing
response.write "<p> </p>"
End Sub
%>