|
-
Mar 18th, 2009, 04:31 PM
#1
Thread Starter
Just Married
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:
protected void Page_Load(object sender, EventArgs e)
{
Response.Buffer = false;
Response.Clear();
Response.ContentType = "application/xml";
// Create an XmlWriter to write the feed into it
using (XmlWriter writer = XmlWriter.Create(Response.OutputStream))
{
// Set the feed properties
SyndicationFeed feed = new SyndicationFeed
(_Title,
_Description,
new Uri(_FeedAlternateLink));
// Add authors
feed.Authors.Add(new SyndicationPerson
(_Email,
_Author,
_AuthorWebsite));
// Add categories
foreach (var category in RSSFeedCategory)
{
feed.Categories.Add(new SyndicationCategory(category.FeedCategory));
}
//Set copyright
feed.Copyright = new TextSyndicationContent
(_CopyrightMessage);
// Set generator
//feed.Generator = "Keyvan's very own RSS Generator :-D";
// Set language
feed.Language = "en-US";
// Add post items
List<SyndicationItem> items = new List<SyndicationItem>();
foreach (var Post in RSSFeedData)
{
SyndicationItem item = new SyndicationItem();
item.Id = Post.FeedId.ToString();
item.Title = TextSyndicationContent.CreatePlaintextContent(Post.FeedTitle);
item.Content = SyndicationContent.CreateXhtmlContent(Post.FeedBody);
item.PublishDate = Post.FeedDate;
item.Categories.Add(new SyndicationCategory(Post.FeedCategory));
items.Add(item);
}
feed.Items = items;
// Write the feed to output
Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(feed);
rssFormatter.WriteTo(writer);
writer.Flush();
}
Response.End();
}
-
Mar 19th, 2009, 02:19 AM
#2
-
Mar 19th, 2009, 09:01 AM
#3
Thread Starter
Just Married
Re: Feed RSS 2.0
I make some changes and all things working well.
Thanks
Shakti
-
Mar 20th, 2009, 06:09 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|