|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
HttpWebResponse object works only 1 time and next time it times ouI have code below which works fine 1 time and next time I call it it would through "time out" exception. What might be causing it? Code Snippet striring strRequest += ""http://maps.google.com/maps/geo?q=" + Address + "&key=" + GoogleKey + "&output=xml"; HttpWebRequest geoRequest = (HttpWebRequest)WebRequest.Create(strRequest); geoRequest.Method = "GET"; geoRequest.Timeout = 5000; geoRequest.KeepAlive = false; geoRequest.Proxy = GlobalProxySelection.GetEmptyWebProxy(); geoRequest.ContentLength = strRequest.Length; XmlDocument myXML = new XmlDocument(); HttpWebResponse geoResponse = (HttpWebResponse)geoRequest.GetResponse(); System.IO.StreamReader readStream = new System.IO.StreamReader(geoResponse.GetResponseStream(), System.Text.Encoding.UTF8); myXML.LoadXml(readStream.ReadToEnd()); geoResponse.Close(); readStream.Close(); |
|||||||||||||||||||||||