title: Check internet connection with InternetGetConnectedState always true
body: <p>I need to check in my Compact Framework app if it has internet connection.</p>
  
  <p>So looking around I found the <code>InternetGetConnectedState</code> method, but in my case every time I check if I have internet connection it returns true, even when I am offline.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>[DllImport("wininet.dll", CharSet = CharSet.Auto)]
  private extern static bool InternetGetConnectedState(ref InternetConnectionState_e lpdwFlags, int dwReserved);
  
  [Flags]enum InternetConnectionState_e : int
  {
      INTERNET_CONNECTION_MODEM = 0x01,
      INTERNET_CONNECTION_LAN = 0x02,
      INTERNET_CONNECTION_PROXY = 0x04,
      INTERNET_RAS_INSTALLED = 0x10,
      INTERNET_CONNECTION_OFFLINE = 0x20,
      INTERNET_CONNECTION_CONFIGURED = 0x40
  }
  
  public Form1()
  {
      InitializeComponent();
      verify();
  }
  
  private void verify()
  {
      // In function for checking internet
      InternetConnectionState_e flags = 0;
      bool isConnected = InternetGetConnectedState(ref flags, 0);
      textBox1.Text = "Con: " + isConnected.ToString();
      textBox1.Text += "\r\nDescr: " + flags.ToString();
  }
  
  private void button1_Click(object sender, EventArgs e)
  {
      verify();
  }
  
  private void button2_Click(object sender, EventArgs e)
  {
      this.Close();
  }
  </code></pre>
  
  <p>I am doing something wrong?</p>