Hi, Does anyone have any code that I can rip that checks to see if a website is online??? Cheers MarkusJ
You can try to ping the website using the process class. Here is an example. VB Code: 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
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
Dont gain the world and lose your soul
Awesome, that's exactly what I am after Thanks MarkusJ
Forum Rules