public byte[] GetResponseFromUrl(string url)
        {
            // If we have a file to post, do a POST with the file as the payload, otherwise
            // do a simple GET
            byte[] responseBytes;

            int retries = 6;
            int msWait  = 200;

            while (retries > 0)
            {
                try {
                    //TODO: WebClient nicely wraps this functionaly but if we need more power
                    // or diagnostics we might move to other WebRequest types that are available.
                    using (CustomWebClient wc = new CustomWebClient()) {
                        if (fileToPost != null)
                        {
                            responseBytes = wc.UploadFile(url, fileToPost);
                        }
                        else if (dataToPost != null)
                        {
                            responseBytes = wc.UploadValues(url, dataToPost);
                        }
                        else
                        {
                            responseBytes = wc.DownloadData(url);
                        }
                    }
                    return(responseBytes);
                }
                catch (WebException) {
                    Thread.Sleep(msWait);
                    retries--;
                    msWait *= 2;
                    if (retries == 0)
                    {
                        throw;
                    }
                }
            }
            throw new Exception("Could not retrieve a response from " + this.Server);
        }
        public byte[] GetResponseFromUrl(string url)
        {
            // If we have a file to post, do a POST with the file as the payload, otherwise
            // do a simple GET
            byte[] responseBytes;

            int retries = 6;
            int msWait = 200;

            while (retries > 0) {
                try {
                    //TODO: WebClient nicely wraps this functionaly but if we need more power
                    // or diagnostics we might move to other WebRequest types that are available.
                    using (CustomWebClient wc = new CustomWebClient()) {
                        if (fileToPost != null)
                            responseBytes = wc.UploadFile(url, fileToPost);
                        else
                            responseBytes = wc.DownloadData(url);
                    }
                    return responseBytes;
                }
                catch (WebException) {
                    Thread.Sleep(msWait);
                    retries--;
                    msWait *= 2;
                    if (retries == 0) {
                        throw;
                    }
                }
            }
            throw new Exception("Could not retrieve a response from " + this.Server);
        }