Way to check server status in code

Is there a way to check the status of a remote server (whether it is running or not) using VBscript or Javascript? I want to make sure that a server is running when the user navaigates to a certain ASP page. If it is not, I plan to redirect.
kbooneAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
chisholmdConnect With a Mentor Commented:
You could use the internet transfer control in your server side script to first make a connection to the target server. It has the response code available (200, 404, etc) Then you can redirect as appropriate.

Set Inet = Server.CreateObject("InetCtls.Inet.1")
Inet.URL = "http://www.someserver.com/"
'Inet.UserName = "MyUserName"
'Inet.Password = "MyPassword"
Inet.AccessType = icDirect
Inet.Protocol = icHTTP
Inet.RemotePort  = 80
Inet.RequestTimeout = 60
strHTMLFile = Inet.OpenURL()
if Inet.ResponseCode <> 200 then
 response.redirect("www.someotherserver.com")
else
 response.write strHTMLFile
end if

Something like that.

dave
0
 
kbooneAuthor Commented:
Thanks for the info chisholmd!
0
 
chisholmdCommented:
np
0
All Courses

From novice to tech pro — start learning today.