# RSS Feeds...

<datetime class="hidden">2003-11-25T00:00</datetime>
<!-- category -- mostlylucidcouk, Imported -->

## 
[RSS Feeds...](https://web.archive.org/web/http://www.mostlylucid.co.uk/archive/2003/11/25/658.aspx) 

posted on [8:16 PM](https://web.archive.org/web/http://www.mostlylucid.co.uk/archive/2003/11/25/658.aspx)

[Rob Howard asked](http://weblogs.asp.net/RHoward/posts/39662.aspx) how other people were doing RSS feeds, well this has been an issue for me recently, where I had to generate RSS feeds for existing objects. I used a little collection of classes to do this which I've uploaded [here](/uploads/RssClasses.zip), here's a quick example of how I'm currenlty using these (names removed to protect the innocent) - note, these are not EXACT Rss, I added one field, xsdDate, 'cos I needed this for a transform (doesn't break readers having this extra bit though!), I'll update this later with a bit more info on these...essentially it passes through the items in an object (badly) named ItemFeedStruct and creates an entry for each one...doing a ToString() then gives me the complete RSS feed for this. Note, I did not write the RSS Classes originally, but I can't find the link to the person that did - if ot was you, leave a comment! UPDATE:  Apparently it's [Adam Kinney's](http://weblogs.asp.net/akinney) from the [GotDotNet Workspace](http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=82651160-90f3-48af-9f99-1e534472f6e8)

```
        private void BindRssControls(ItemFeedStruct theFeed)
        {
            
            string thisUrl = "http://" + Request.Url.Host + Application["AppPath"];
            RSSFeed rFeed = new RSSFeed("Latest  " + cts.ContentTypeName,thisUrl,"Feed for  Communities");
    
            for(int i=0; i < theFeed.items.Length; i++)
            {
                RSSItem rItem;
                if(_contentType != ctl.ForumThreads)
                {
                    rItem = new RSSItem(Server.HtmlEncode(theFeed.items[i].ItemTitle),Server.HtmlEncode(theFeed.items[i].ShortDescription));    
                }
                else
                {
                    string longDesc= theFeed.items[i].LongDescription;
                    if(longDesc.IndexOf(' ') > -1)
                    {
                        longDesc= longDesc.Substring(0,longDesc.LastIndexOf(' '));
                    }
                    rItem = new RSSItem(Server.HtmlEncode(theFeed.items[i].ItemTitle),Server.HtmlEncode(longDesc));    
                }
                rItem.PubDate = theFeed.items[i].ItemValidFrom.ToUniversalTime().ToString("r");
                rItem.XsdDate = theFeed.items[i].ItemValidFrom.ToString("s");
                rItem.Guid = theFeed.items[i].itemId.ToString();
                rItem.Link = Server.HtmlEncode(theFeed.items[i].ViewUrl);
                rItem.Author = Server.HtmlEncode(theFeed.items[i].AuthorName);
                RSSCategoryCollection rCat = new RSSCategoryCollection();
                rCat.Add(new RSSCategory(Server.HtmlEncode(theFeed.items[i].Category)));
                rItem.Categories = rCat;
                rFeed.Items.Add(rItem);
            }
            Response.ContentType = "text/xml";
            Page.EnableViewState = false;
            RssLiteral.Text = rFeed.ToString();
        }
```