# RSS Feeds...

<datetime class="hidden">2004-03-12T00:00</datetime>

<!-- category -- mostlylucidcouk, Imported, ASP.NET, XML, Web Development -->
[سأل روب هوارد](http://weblogs.asp.net/RHoward/posts/39662.aspx) كيف كان أشخاص آخرون يقومون ببث RSS..,.. حسناً لقد كان هذا مشكلاً بالنسبة لي مؤخراً.. ,.. حيث كان علي أن أقوم بإنتاج بث RSS لأشياء موجودة.. [هنا](/uploads/RssClasses.zip), هنا' مثال سريع على كيف أستخدم هذه الـ'M currenlty (names removed to protect the innocentM SK4 - noteMSC6 these are not EXACT RssMスク7 I added one fieldMSSK8 xsdDateMNK9 ♫'cos I needed this for a transformation MSSK11doesnMST12t break readers having this extra bit thoughMS!), IMSP14ll update this later with a bit more info on theseMSL15 essentially it passes through the items in an object МSK16badlyMSV17 named ItemFeedStruct and creates an entry for each oneMSR18doing a ToStringMSA19 then gives me the complete RSS feed for thisM SA20 NoteM Sa21 I didn't write the RSS Classes originally M SA22 but I canM S SA23t find the link to the person that did MS SA24 if ot was you MS S SA25 leave a commentMS S SA26 UPDATEMS SA27 Apparently it M S SA28s [آدم كيني](http://weblogs.asp.net/akinney) من [مساحة عمل GotDotNet](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();
        }
```