Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

ASP Script to check if a web site is up

  • 19-01-2005 11:21am
    #1
    Registered Users, Registered Users 2 Posts: 12,309 ✭✭✭✭


    Would anyone know a handy asp script for checking if a site is up or not?
    For example, I'd like to be able to check if a particular URL is up and active before grabbing data from it or providing a link to it.

    Any suggestions?

    (ASP only please)


Comments

  • Registered Users, Registered Users 2 Posts: 7,740 ✭✭✭mneylon


    have a look at:
    http://www.aspin.com/home/components/internet/pingfunc

    You basically want to do a ping on a hostname and depending on the response take action (or not)

    If it was a specific URL you could try running a HEAD command on it to get the response code I suppose ...


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    If the Microsoft XML parser is installed (or can be) on your webserver, then you can create a HTTP REQUEST for a page on the remote server. If you do your error handling, you can then return a message if the request fails.

    Eoin


  • Registered Users, Registered Users 2 Posts: 12,309 ✭✭✭✭Bard


    It's the XML Parser that I'm using to grab the data from the other site so I guess I'll just read up on error handling. Thanks.


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    found this on ASP FAQ :
    <% 
        ' deliberate typo: 
        url = "http://www.espn.co/main.html"  
        set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")  
        on error resume next 
        xmlhttp.open "GET", url, false 
        xmlhttp.send ""  
        if err.number <> 0 then 
            response.write "Url not found" 
        else 
            Response.write xmlhttp.responseText  
        end if 
        set xmlhttp = nothing 
    %>
    

    This should do what you are looking for?

    Eoin


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin




  • Advertisement
Advertisement