static private Stream RetrieveData(string sUrl) { if (String.IsNullOrEmpty(sUrl) || sUrl[0] == '/') { return(null); } //sUrl = this.Settings.UpdateUrl(sUrl); HttpWebRequest request = null; HttpWebResponse response = null; try { request = (HttpWebRequest)WebRequest.Create(sUrl); request.Timeout = 20000; response = (HttpWebResponse)request.GetResponse(); if (response != null) // Get the stream associated with the response. { return(response.GetResponseStream()); } } catch (Exception e) { Log.Error(e); } finally { //if (response != null) response.Close(); // screws up the decompression } return(null); }
private static Stream RetrieveData(string sUrl) { if (sUrl == null || sUrl.Length < 1 || sUrl[0] == '/') { return null; } //sUrl = this.Settings.UpdateUrl(sUrl); HttpWebRequest request = null; HttpWebResponse response = null; try { request = (HttpWebRequest)WebRequest.Create(sUrl); request.Timeout = 20000; response = (HttpWebResponse)request.GetResponse(); if (response != null) // Get the stream associated with the response. return response.GetResponseStream(); } catch (Exception e) { Log.Error(e); } finally { //if (response != null) response.Close(); // screws up the decompression } return null; }