Test Foro de elhacker.net SMF 2.1

Programación => .NET (C#, VB.NET, ASP) => Programación General => Programación Visual Basic => Mensaje iniciado por: Rudy21 en 5 Octubre 2008, 03:20 AM

Título: verificar Si Web Está Online
Publicado por: Rudy21 en 5 Octubre 2008, 03:20 AM
Pues Estoy haciendo un programa que verifique si una web está online cada 15min o determinado time

ya intente con text1.text = Inet1.openurl

si hay codigo en el textbox pues está online si no pues offline

pero no me funciona muy bien

alguna idea?

hago que meta un texto en un txt como log

tmb intente con fileexists pero nada

alguna idea

Gracias!
Título: Re: verificar Si Web Está Online
Publicado por: naderST en 5 Octubre 2008, 03:39 AM
Código (vb) [Seleccionar]

Option Explicit

Private Sub Form_Load()
    Dim Response As String
   
    Response = Inet1.OpenURL("http://localhost")
   
    If Response = "" Then
        MsgBox "Offline"
    Else
        MsgBox "Online"
    End If
End Sub

Título: Re: verificar Si Web Está Online
Publicado por: Rudy21 en 5 Octubre 2008, 03:42 AM
sencillo y demasiado funcional jajaja

mil gracias

Salu2
Título: Re: verificar Si Web Está Online
Publicado por: seba123neo en 5 Octubre 2008, 07:04 AM
Hola,en vez de usar un control ocx como el Inet podes usar la api InternetCheckConnection ,algo asi:

Código (vb) [Seleccionar]
Option Explicit

Private Const FLAG_ICC_FORCE_CONNECTION = &H1

Private Declare Function InternetCheckConnection Lib "wininet.dll" Alias "InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As Long, ByVal dwReserved As Long) As Long

Private Sub Form_Load()
If InternetCheckConnection("http://www.google.com", FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then
    MsgBox "No esta disponible"
Else
    MsgBox "Si esta disponible"
End If
End Sub


saludos.