Results 1 to 4 of 4

Thread: Feed RSS 2.0

  1. #1

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Question Feed RSS 2.0

    Hello friends I create this user control for display feed, all is running fine but this is not showing any feed , it show feed code error in page title after complete page load.



    C# Code:
    1. protected void Page_Load(object sender, EventArgs e)
    2.         {
    3.             Response.Buffer = false;
    4.             Response.Clear();
    5.             Response.ContentType = "application/xml";
    6.             // Create an XmlWriter to write the feed into it
    7.             using (XmlWriter writer = XmlWriter.Create(Response.OutputStream))
    8.             {
    9.                 // Set the feed properties
    10.                 SyndicationFeed feed = new SyndicationFeed
    11.                     (_Title,
    12.                     _Description,
    13.                     new Uri(_FeedAlternateLink));
    14.                 // Add authors
    15.                 feed.Authors.Add(new SyndicationPerson
    16.                     (_Email,
    17.                     _Author,
    18.                    _AuthorWebsite));
    19.                 // Add categories
    20.                 foreach (var category in RSSFeedCategory)
    21.                 {
    22.                     feed.Categories.Add(new SyndicationCategory(category.FeedCategory));
    23.                 }
    24.                 //Set copyright
    25.                 feed.Copyright = new TextSyndicationContent
    26.                                      (_CopyrightMessage);
    27.                 // Set generator
    28.                 //feed.Generator = "Keyvan's very own RSS Generator :-D";
    29.                 // Set language
    30.                 feed.Language = "en-US";
    31.                 // Add post items
    32.                 List<SyndicationItem> items = new List<SyndicationItem>();
    33.                 foreach (var Post in RSSFeedData)
    34.                 {
    35.                     SyndicationItem item = new SyndicationItem();
    36.                     item.Id = Post.FeedId.ToString();
    37.                     item.Title = TextSyndicationContent.CreatePlaintextContent(Post.FeedTitle);
    38.                     item.Content = SyndicationContent.CreateXhtmlContent(Post.FeedBody);
    39.                     item.PublishDate = Post.FeedDate;
    40.                     item.Categories.Add(new SyndicationCategory(Post.FeedCategory));
    41.                     items.Add(item);
    42.                 }
    43.                 feed.Items = items;
    44.                 // Write the feed to output
    45.                 Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(feed);
    46.                 rssFormatter.WriteTo(writer);
    47.                 writer.Flush();
    48.  
    49.             }
    50.             Response.End();
    51.         }

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Feed RSS 2.0

    And the error is...?

  3. #3

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up Re: Feed RSS 2.0

    I make some changes and all things working well.
    Thanks
    Shakti

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Feed RSS 2.0

    You're welcome.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width