Exemple #1
0
        public byte[] Post(string uri, NameValueCollection pairs)
        {
            byte[] response = null;
            int    tries    = 0;

            using (WebDownload client = new WebDownload())
            {
retry:
                try
                {
                    response = client.UploadValues(uri, pairs);
                }
                catch (Exception ex)
                {
                    if (ex.Message == "The operation has timed out")
                    {
                        return(null);
                    }
                    tries++;
                    if (tries == 1)
                    {
                        return(null);
                    }
                    Thread.Sleep(20 * tries * 1000);
                    goto retry;
                }
            }
            return(response);
        }