Exemple #1
0
        // Obtain a response, ensuring that we obtain the response's cookies
        private HttpWebResponse GetResponse(HttpWebRequest request)
        {
            debug("GetResponse(): Requesting " + request.RequestUri);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            UpdateCredentials(response);
            Credentials.ToFile();
            debug("GetResponse(): Response is " + JsonConvert.SerializeObject(response));
            debug("GetResponse(): Credentials are " + JsonConvert.SerializeObject(Credentials, Formatting.Indented));

            return(response);
        }
Exemple #2
0
        // Obtain a response, ensuring that we obtain the response's cookies
        private HttpWebResponse GetResponse(HttpWebRequest request)
        {
            debug("GetResponse(): Requesting " + request.RequestUri);

            HttpWebResponse response;

            try
            {
                response = (HttpWebResponse)request.GetResponse();
            }
            catch (WebException wex)
            {
                warn("GetResponse(): failed to obtain response, error code " + wex.Status);
                return(null);
            }
            debug("GetResponse(): Response is " + JsonConvert.SerializeObject(response));
            UpdateCredentials(response);
            Credentials.ToFile();
            debug("GetResponse(): Credentials are " + JsonConvert.SerializeObject(Credentials, Formatting.Indented));
            return(response);
        }