Click here to Skip to main content
15,886,035 members
Articles / Web Development / ASP.NET

A very standard, powerful and easy to use Sample and Library for working on RSS 2.0

Rate me:
Please Sign up or sign in to vote.
4.85/5 (23 votes)
18 Feb 2005MIT1 min read 46.1K   649   51  
With this library, you can easily create some RSS 2.0 files for your site and/or use some RSS 2.0 files from other sites into your site.
namespace working_on_rss
{
	public class create_rss2_sample1 : System.Web.UI.Page
	{
		#region Web Form Designer generated code
		override protected void OnInit(System.EventArgs e)
		{
			InitializeComponent();
			base.OnInit(e);
		}

		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion

		private void Page_Load(object sender, System.EventArgs e)
		{
			IranianExperts.RSS.RSSChannel oRSSChannel = new IranianExperts.RSS.RSSChannel("Channel Title", "Channel Link", "Channel Description");
			oRSSChannel.PubDate = System.DateTime.Now.ToString();

			IranianExperts.RSS.RSSRoot oRSSRoot = new IranianExperts.RSS.RSSRoot(oRSSChannel, Response.OutputStream);

			IranianExperts.RSS.RSSItem oRSSItem = null;

			oRSSItem = new IranianExperts.RSS.RSSItem("Item 1", "http://www.Item1.com");
			oRSSItem.PubDate = System.DateTime.Now.ToString();
			oRSSRoot.Items.Add(oRSSItem);

			oRSSRoot.Items.Add("Item 2");

			oRSSRoot.Items.Add("Item 3", "http://www.Item3.com");

			Response.Clear();
			Response.ContentEncoding = System.Text.Encoding.UTF8;
			Response.ContentType = "text/xml";
			IranianExperts.RSS.RSSUtilities.PublishRSS(oRSSRoot);
			Response.End();
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Web Developer Sematec Ins.
Iran (Islamic Republic of) Iran (Islamic Republic of)
My experiences are:

HTML 5.0, CSS 3.0
JQuery, Angular JS, Bootstrap

MVC 5.0, WEB API, c#

My Site URLs:
http://www.IranianExperts.ir
http://www.IranianExperts.com

My Yahoo Group URL: http://groups.yahoo.com/group/iranianexperts

Mobile: 0098-912-108-7461
Address: Tehran, Tehran, Iran

Comments and Discussions