Thursday, October 11, 2012

How to solve problem, "The operation has timed out at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)"

Need to dispose HttpWebResponse

            using (HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse())
            {
                using (var str = new StreamReader(webresponse.GetResponseStream()))
                    {
                        result = str.ReadToEnd();
                    }
                webresponse.Close();
            }

No comments:

Post a Comment