<caching> <outputCacheSettings> <outputCacheProfiles> <add name="CacheHour" duration="100" varyByParam="none" location="Any"/> </outputCacheProfiles> </outputCacheSettings> </caching>
<%@ OutputCache CacheProfile="CacheHour" %> private void loadFeedLindaIkeji() { try { //RssFeedClass rsscls = new RssFeedClass(); WebRequest MyRssRequest = WebRequest.Create(@"C:\inetpub\wwwroot\RSSFEED\App_Data\XMLFile2.xml"); //WebRequest MyRssRequest = WebRequest.Create("http://feeds.feedburner.com/blogspot/OqshX"); WebResponse MyRssResponse = MyRssRequest.GetResponse(); Stream MyRssStream = MyRssResponse.GetResponseStream(); // Load previously created XML Document XmlDocument MyRssDocument = new XmlDocument(); MyRssDocument.Load(MyRssStream); MyRssList = MyRssDocument.SelectNodes("rss/channel/item[position()<7]"); string sTitle = ""; string sUrlFriendlyTitle = ""; string sLink = ""; string sDescription = ""; DateTime? sDate = null; string sAuthor = "Linda Ikeji"; // Iterate/Loop through RSS Feed items for (int i = 0; i < MyRssList.Count; i++) { XmlNode MyRssDetail; MyRssDetail = MyRssList.Item(i).SelectSingleNode("title"); if (MyRssDetail != null) { sTitle = MyRssDetail.InnerText; sUrlFriendlyTitle = rsscls.URLFriendly(sTitle); } else sTitle = ""; MyRssDetail = MyRssList.Item(i).SelectSingleNode("link"); if (MyRssDetail != null) sLink = MyRssDetail.InnerText; else sLink = ""; MyRssDetail = MyRssList.Item(i).SelectSingleNode("pubDate"); if (MyRssDetail != null) sDate = Convert.ToDateTime(MyRssDetail.InnerText); else sDate = null; MyRssDetail = MyRssList.Item(i).SelectSingleNode("description"); if (MyRssDetail != null) { sDescription = MyRssDetail.InnerText; } else { sDescription = ""; } // Now generating HTML table rows and cells based on Title,Link & Description HtmlTableCell block = new HtmlTableCell(); block.InnerHtml = "<span style="font-weight:bold;"><a href="1111.aspx?n=" + rsscls.URLFriendly(sTitle) + "">" + sTitle + "</a></span>"; HtmlTableRow row = new HtmlTableRow(); row.Cells.Add(block); tblFeedLindaIkeji.Rows.Add(row); HtmlTableCell block_description = new HtmlTableCell(); block_description.InnerHtml = "<p align="justify" style="border-removedsolid 1px #000;">" + DateTime.Parse(sDate.ToString()).ToString("MMMM dd, yyyy") + "</p>"; HtmlTableRow row2 = new HtmlTableRow(); row2.Cells.Add(block_description); tblFeedLindaIkeji.Rows.Add(row2); } } catch (Exception) { HtmlTableCell block = new HtmlTableCell(); block.InnerHtml = "<h4>Linda Ikeji Feeds Temporarily Unavailable!<h4 />"; HtmlTableRow row = new HtmlTableRow(); row.Cells.Add(block); tblFeedLindaIkeji.Rows.Add(row); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)