This is the first time I tried to translate things, so I chose a very simple article. You don't want to throw me. (www.csnote.com) How to use C # to detect if your computer is connected to the Internet, which is more convenient than the other methods I know. We can implement an API function that returns a BOOL value (InternetGetConnectedState). This function has two parameters. The first parameter is a integer variable. After calling the function, this variable will save the status of the connection (eg, through the MODEN connection, connect, offline, etc.), you can go to www.msdn. COM gets more information about this variable. The second parameter is a reserved variable, which must be set to 0. In the routine below, we will use this API function to establish a class containing a static function. It will return TRUE in the case where it is connected, and then returns false! using System; using System.Runtime; using System.Runtime.InteropServices; public class InternetCS {// Creating the extern function ... [DllImport ( "wininet.dll")] private extern static bool InternetGetConnectedState (out int Description, int ReservedValue ); // Creating a Function That Uses The API Function ... public static bool isconnectedTointernet () {int desc; return internetGetConnectedState (out dec, 0);}}