Hi, I have a WM 6.1 Prof. application that checks updates when user wishes to do so.
I want to check if there is any avaliable connection (GPRS or Wifi) before it attempts to connect to server.
I am also using openNETCF.NET dll here is what I have done but it doesn't work everytime,
also I am not sure which type of connection should I use and so.
Ok do you think is this good?
Thank you very much!
  private static HttpWebRequest ConnectWeb(string urlx)
  {
      try
      {
          HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(urlx));
          request.ContentType = @"application/octet-stream";
          request.Credentials = CredentialCache.DefaultCredentials;
          request.Timeout(6000);
          return request;
      }
      catch (Exception ex)
      {
          MessageBox.Show(Lang.CONNECTIONPROBLEM);
          return null;
      }
  }
    private bool downloadTest()
    {
        Stream stream;
        HttpWebResponse response;
        HttpWebRequest request = ConnectWeb(FileManager.url);
        if (request!=null)
        {
            try
            {
                using (response = (HttpWebResponse)request.GetResponse())
                {
                    using (stream = response.GetResponseStream())
                    {
                        byte[] data = ReadFully(stream, (int)response.ContentLength);
                        writeByteArrayToFile(data, "data.zip");                                           
                    }                  
                }
                response.Close();
                stream.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Lang.CONNECTIONPROBLEM);
                return false;
            }
}