{"id":114,"date":"2010-10-11T17:16:44","date_gmt":"2010-10-11T21:16:44","guid":{"rendered":"http:\/\/wukenny.host-ed.net\/?p=114"},"modified":"2010-10-11T17:16:44","modified_gmt":"2010-10-11T21:16:44","slug":"implement-rss-news-feed-in-net","status":"publish","type":"post","link":"http:\/\/kennywu.info\/?p=114","title":{"rendered":"Implement RSS news feed in .Net"},"content":{"rendered":"<p>There are many ready to use RSS wrappers on the net, the one from<a href=\"http:\/\/webserviceshare.com\/Default.aspx\"> Web Service Share <\/a>is easy to use and comes on top from Google search.<br \/>\nDownload two DLL, \t<\/p>\n<ul>\n<li>Wss.Common.dll <\/li>\n<li> Wss.News.WebService.PcWorldNews.GetDataFeed.dll<\/li>\n<\/ul>\n<p>from <a href=\"http:\/\/webserviceshare.com\/News\/Service\/PC-World-News\/GetDataFeed.htm\"> Class Library<\/a> add them to the <strong>Bin <\/strong>folder. Add the following snippet to the aspx markup.<\/p>\n<pre lang=\"asp\"><asp:Literal ID=\"Literal1\" runat=\"server\" EnableViewState=\"False\"><\/asp:Literal><\/pre>\n<p>The code behind file. <\/p>\n<pre lang=\"csharp\">\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing System.Web.UI;\nusing System.Web.UI.WebControls;\n\nusing Wss.Common;\nusing WebServices = Wss.News.WebServices;\nusing Rss = Wss.News.Rss20;\n\n\npublic partial class _Default : System.Web.UI.Page \n{\n    protected void Page_Load(object sender, EventArgs e)\n    {\n        int _rssNum = 10;\n        Rss.Result rssResult = WebServices.PcWorldNews.GetDataFeed();        \n        foreach (var _rss in GetRss.SelectRss(rssResult,   _rssNum))\n        {\n            Literal1.Text += String.Format(\"<a href=\"{1}\">{0}<\/a><br \/><hr \/>\", \n                _rss.Title, _rss.Link);\n        }        \n    }\n}\n\npublic struct aRss {\n    public string Title { get; set; }\n    public string Link { get; set; }    \n    \/\/public string Description { get; set; }    \n}\nstatic public class GetRss {    \n    \n    static public List<aRss> SelectRss(Rss.Result rssResult, int _rssNum)\n    {        \n        List<aRss> allRss = new List<aRss>();\n        for (int i = 0; i < Math.Min(_rssNum, rssResult.Items.Count); i++)\n        {\n            allRss.Add(new aRss\n            {\n                Title = rssResult.Items[i].GetTitle(\"\"),\n                Link = rssResult.Items[i].GetLink(\"\"),\n                \/\/Description = _item.GetDescription(\"\")                \n            }\n            );\n        }        \n        return allRss;\n    }\n}\n\n<\/pre>\n<p>The class will return only the first 10 entries. The number is specified by the variable \"_rssNum\".<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are many ready to use RSS wrappers on the net, the one from Web Service Share is easy to use and comes on top from Google search. Download two DLL, Wss.Common.dll Wss.News.WebService.PcWorldNews.GetDataFeed.dll from Class Library add them to the &hellip; <a href=\"http:\/\/kennywu.info\/?p=114\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,4],"tags":[51],"class_list":["post-114","post","type-post","status-publish","format-standard","hentry","category-internet","category-programing","tag-rss"],"_links":{"self":[{"href":"http:\/\/kennywu.info\/index.php?rest_route=\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kennywu.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kennywu.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kennywu.info\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kennywu.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=114"}],"version-history":[{"count":0,"href":"http:\/\/kennywu.info\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions"}],"wp:attachment":[{"href":"http:\/\/kennywu.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kennywu.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kennywu.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}