1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Rep Power

    Need help for code to check if website is down

    Hi Guyz ,
    I am wondering if some one can help me please . I have got a asp page which check if the specific website is UP/Down . but unfortunately this code is not working in properly . What is happening actually if i pass an invalid webaddress it tells me that this web site is not working but i pass a valid webaddress where web is down it tells me that web site is working .
    My Code is :-

    <% response.buffer = TRUE %>
    <!-- #include file="i_axapta.asp" -->
    // Get the WebAddress to be checked from the html form
    Dim error
    CheckWebAddress = "(WebAddress address blocked: See forum rules)"
    // create an XMLHTTP object that is the vehicle for the page check
    Set GetConnection = CreateObject("Microsoft.XMLHTTP")
    // open a path to the chosen WebAddress and attempt to send data to it
    GetConnection.Open "get", CheckWebAddress, False
    // check the return code, 200 mean OK, all the rest are warnings or errors
    // If 200 is returned, this script redirects to the valid page, if not it returns an error statement
    if GetConnection.status = 200 then

    id = webApplication().call ("JS_sendWebFailureEmail",GetConnection.status,checkWebAddress,error)



    id = webApplication().call ("JS_sendWebFailureEmail",GetConnection.status,checkWebAddress,error)


    end if
    // get rid of the XMLHTTP object
    Set GetConnection = Nothing
    <SCRIPT LANGUAGE="JavaScript">
    function closeWindow() {

    <BODY onLoad="JavaScript: closeWindow();">
    Now i don't know what i am doing wrong here
    I will appreciate any quick help as this critical for my project
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Rep Power
    If your server side asp code is using vbscript (which is the default for server side classic asp) then your syntax is all wrong. For example, "//" is not a comment marker in vbscript.
    Doug G
    I've never been able to appreciate the sublime arrogance of folks who feel they were put on earth just to save other folks from themselves .." - Donald Hamilton

IMN logo majestic logo threadwatch logo seochat tools logo