[DllImport("wininet.dll")]private static extern bool InternetGetConnectedState(ref uint connected, uint reserved);static uint uConnection = 0x20; public static bool HasInternetConnection{ get { return InternetGetConnectedState(ref uConnection, 0); }}