Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verify interet connection
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01126557
Message ID:
01126561
Vues:
21
This message has been marked as a message which has helped to the initial question of the thread.
Dawa,
I used this method in 1.1:
using System ;
using System.Runtime ;
using System.Runtime.InteropServices ; 
public class InternetCS
{
  [DllImport("wininet.dll")]
  private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ;

  public static bool IsConnectedToInternet( )
  {
    int Desc ;
    return InternetGetConnectedState( out Desc, 0 );
  }
}
If you don't want to use "old" DLLs and stay with managed code you could us the new Ping class introduced in 2.0. You could try to ping a server that is "always" up (like cnn.com or levelextreme.com). I looked briefly at the Ping examples in the M$ docs and the examples look good.

HTH,
Einar

>Hi all,
>
>How do verify the existence of a live connection to the internet from the computer that is running my application?
>
>TIA
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform