Hi vaibhavN,
Please refer with below code and check
protected void Page_Load(object sender, EventArgs e)
{
GetRSS();
}
private void GetRSS()
{
//Create a WebRequest
WebRequest rssReq = WebRequest.Create("http://www.asp.net/rss/content");
//Set the timeout in Seconds for the WebRequest
rssReq.Timeout = 5000;
try
{
//Get the WebResponse
WebResponse rep = rssReq.GetResponse();
//Read the Response in a XMLTextReader
XmlTextReader xtr = new XmlTextReader(rep.GetResponseStream());
//Create a new DataSet
DataSet ds = new DataSet();
//Read the Response into the DataSet
ds.ReadXml(xtr);
//Bind the Results to the Repeater
rssRepeater.DataSource = ds.Tables[2];
rssRepeater.DataBind();
}
catch (Exception ex)
{
throw ex;
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
GetRSS()
End Sub
Private Sub GetRSS()
'Create a WebRequest
Dim rssReq As WebRequest = WebRequest.Create("http://www.asp.net/rss/content")
'Set the timeout in Seconds for the WebRequest
rssReq.Timeout = 5000
Try
'Get the WebResponse
Dim rep As WebResponse = rssReq.GetResponse()
'Read the Response in a XMLTextReader
Dim xtr As New XmlTextReader(rep.GetResponseStream())
'Create a new DataSet
Dim ds As New DataSet()
'Read the Response into the DataSet
ds.ReadXml(xtr)
'Bind the Results to the Repeater
rssRepeater.DataSource = ds.Tables(2)
rssRepeater.DataBind()
Catch ex As Exception
Throw ex
End Try
End Sub