private void GetNews(string blobXmlFilePath = "") { try { XmlDocument xdoc = new XmlDocument(); string newsXml = string.Empty; if (blobXmlFilePath == "") { string basePath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["MovieList"]); string filePath = Path.Combine(basePath, "News.xml"); xdoc.Load(filePath); } else { xdoc.Load(blobXmlFilePath); } var items = xdoc.SelectNodes("News/Link"); if (items != null) { foreach (XmlNode item in items) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(item.InnerText); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); if (response.StatusCode == HttpStatusCode.OK) { #region Get News Content Stream receiveStream = response.GetResponseStream(); StreamReader readStream = null; if (response.CharacterSet == null) readStream = new StreamReader(receiveStream); else readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet)); newsXml = readStream.ReadToEnd(); List<NewsEntity> news = ParseNewsItems(newsXml, item.Attributes["type"].Value); TableManager tblMgr = new TableManager(); tblMgr.UpdateNewsById(news); response.Close(); readStream.Close(); #endregion } } } } catch (Exception ex) { Console.Write(ex.Message); } }