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

    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    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 %>
    <HTML>
    <!-- #include file="i_axapta.asp" -->
    <%
    //
    // Get the WebAddress to be checked from the html form
    checkWebAddress=Request.QueryString("checkWebAddress")
    Dim error
    error=false
    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
    GetConnection.Send()
    //
    // 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

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

    response.write(id)


    else
    error=true

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

    response.write(id)



    end if
    //
    // get rid of the XMLHTTP object
    //
    Set GetConnection = Nothing
    %>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function closeWindow() {
    window.open('','_self','');

    window.close();
    }
    </SCRIPT>
    </HEAD>
    <BODY onLoad="JavaScript: closeWindow();">
    </BODY>
    </HTML>
    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
    Posts
    14,440
    Rep Power
    4539
    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
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester

IMN logo majestic logo threadwatch logo seochat tools logo