Saturday, May 26, 2007 12:02 AM
kkchan
A simple way to retrieve web page content
I was asked how to GET rss feed from a web site. During research, I found couple of ways to do it in .NET. Below is the simplest way as I can get.
///Sample using System.Net
WebRequest wr = HttpWebRequest.Create(@"http://msdn.microsoft.com/globalrss/en-us/global-msdn-en-us.xml");
WebResponse ws = wr.GetResponse();
StreamReader sr = new StreamReader(ws.GetResponseStream());
string str = sr.ReadToEnd();
this.textBox1.Text = str;
///Sample using System.Data
DataSet ds = new DataSet()
ds.ReadXml(@"http://msdn.microsoft.com/globalrss/en-us/global-msdn-en-us.xml");
string str = ds.GetXml()
this.textBox1.Text = str;
I feel so excited when I found that I can read web content using DataSet. Amazing!!