C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

Consuming RSS feeds in asp.net


Posted Date: 01 Jul 2008    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: venkata suresh boyinaMember Level: Bronze    
Rating: 1 out of 5Points: 10



RSS, expanded as Really Simple Syndication, has the following features:

1.RSS allows you to syndicate your site content
2.RSS can be automatically updated.
3.RSS is written in XML
4.RSS is useful for websites like news sites,shopping cart sites.

The structure of a RSS File takes the following form



<rss>
<channel>
<item>
</item>
</channel>
</rss>


Sample Code:This component is very useful .

      
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Text;
using System.Net;
using System.IO;
/// <summary>
/// Summary description for RSSComponent
/// </summary>
public class RSSComponent
{

XmlTextReader reader = null;

string url, proxyname, username, password;
int portno;
XmlDocument xmlDoc = new XmlDocument();

public RSSComponent(string url)
{

try
{
this.url = url;

}
catch (Exception exp)
{
throw exp;
}
}

public RSSComponent(string url, string proxyname, int portno, string username, string password)
{
try
{
this.url = url;
this.proxyname = proxyname;
this.portno = portno;
this.username = username;
this.password = password;

}
catch (Exception exp)
{
throw exp;
}

}

public XmlDocument GetRSSData()
{

if (proxyname != string.Empty && proxyname != null)
{
System.Net.WebRequest req = System.Net.WebRequest.Create(url);
req.Proxy = new System.Net.WebProxy(proxyname, portno);
req.Proxy.Credentials = new NetworkCredential(username, password);
System.Net.WebResponse resp = req.GetResponse();
System.IO.StreamReader textReader = new System.IO.StreamReader(resp.GetResponseStream());
reader = new XmlTextReader(textReader);

xmlDoc.Load(reader);
}
else
{
reader = new XmlTextReader(url);
xmlDoc.Load(reader);
}

return xmlDoc;
}

}






Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Rss  .  Asp.net  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Working with Tiff Image and Resizing Images
Previous Resource: Working with datalist control
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use