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; }
}
|
No responses found. Be the first to respond and make money from revenue sharing program.
|