[DllImport("wininet.dll")]private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);/// <summary> /// RetrIEves the connected state of the local system. /// </summary> /// <returns>Returns True if there is an Internet connection, or False otherwise.</returns> public bool IsConnected(){ int connectionDescription = 0; return InternetGetConnectedState(out connectionDescription, 0);}