PDA

View Full Version : checking if a server is online


Bluemonkey
10-04-2002, 04:10 PM
is there any way i can see if a server is online?? i thought of maby using FileExists object to check if a file is on a server and if it is then it should be online if not then the server should be down.

thanks for the help

rcreyes
10-24-2002, 05:52 PM
Are you talking about SQL server or server other than the Web Server where your ASP apps resides?

Bluemonkey
10-24-2002, 06:28 PM
i wanna test if another server a second one is online so if it is then the user is sent to that one but if it isnt the user stays on the current one

whammy
10-25-2002, 12:13 AM
Can you explain in English, exactly what you are trying to accomplish, and why?

:confused:

glenngv
10-25-2002, 03:25 AM
a javascript solution is more appropriate.


<script language="javascript">
var down = false;
function checkSite(){
down=false;
var chkSite = new Image();
chkSite.onerror = new Function("down=true;alert('Sorry, the server is down. Please try again later.')");

//set delay to wait for occurrence of onerror, make it longer as necessary (depends on the loading time of the file)
chkSite.onload = new Function("setTimeout('openSite()',1000)");

//any file, image, html or asp, recommended is the file with the smallest size
chkSite.src = "http://anothersite/index.htm";
}

function openSite(){
if (!down) {
win = window.open("http://anothersite/index.htm","Site2");
win.focus();
}
}
</script>


<a href="http://anothersite/index.htm" target="Site2" onclick="checkSite();return false;">Go to another site</a>