FlickrNet.Flickr.DoGetResponse C# (CSharp) Method

DoGetResponse() private method

A private method which performs the actual HTTP web request if the details are not found within the cache.
private DoGetResponse ( string url ) : string
url string The URL to download.
return string
        private string DoGetResponse(string url)
        {
            HttpWebRequest req = null;
            HttpWebResponse res = null;

            // Initialise the web request
            req = (HttpWebRequest)HttpWebRequest.Create(url);

            req.Method = (CurrentService==SupportedService.Zooomr?"GET":"POST");

            #if !WindowsCE
            if( req.Method == "POST" ) req.ContentLength = 0;
            req.UserAgent = UserAgent;
            if( Proxy != null ) req.Proxy = Proxy;
            req.Timeout = HttpTimeout;
            req.KeepAlive = false;
            #endif

            try
            {
                // Get response from the internet
                res = (HttpWebResponse)req.GetResponse();
            }
            catch(WebException ex)
            {
                if( ex.Status == WebExceptionStatus.ProtocolError )
                {
                    HttpWebResponse res2 = (HttpWebResponse)ex.Response;
                    if( res2 != null )
                    {
                        throw new FlickrException((int)res2.StatusCode, res2.StatusDescription);
                    }
                }
                throw new FlickrException(9999, ex.Message);
            }

            string responseString = string.Empty;

            using (StreamReader sr = new StreamReader(res.GetResponseStream()))
            {
                responseString = sr.ReadToEnd();
            }

            return responseString;
        }
Flickr