using System; using System.Runtime; using System.Runtime.InteropServices; public static class InternetConnectionStatus { [DllImport("wininet.dll")] private extern static bool InternetGetConnectedState(out int Description, int Reserved); public static bool Connected() { int Descript; return InternetGetConnectedState(out Descript, 0); } }