Click to See Complete Forum and Search --> : Determine if a website is online..
MarkusJ_NZ
Sep 30th, 2002, 04:16 AM
Hi, Does anyone have any code that I can rip that checks to see if a website is online???
Cheers
MarkusJ
DevGrp
Sep 30th, 2002, 09:41 AM
You can try to ping the website using the process class.
Here is an example.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim p As New Process()
With p
.StartInfo.Arguments = "www.microsoft.com"
.StartInfo.WindowStyle = ProcessWindowStyle.Normal
.StartInfo.FileName = "ping"
End With
p.Start()
p.WaitForExit()
If (p.ExitCode = 1) Then 'if exit code is 0 then website is up
MessageBox.Show("Website down")
End If
End Sub
MarkusJ_NZ
Sep 30th, 2002, 05:20 PM
Awesome, that's exactly what I am after
Thanks
MarkusJ
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.