[System.Runtime.InteropServices.DllImport("wininet.dll")]
private static extern bool InternetGetConnectedState(out int connectionDescription, int reservedValue);
private bool IsConnected()
{
int I = 0;
bool state = InternetGetConnectedState(out I, 0);
return state;
}