ASP.NET RSS Feeds Display | Get

In this article, I will show you, How to display RSS feeds on your website. Actually, RSS feeds is an XML file. In ASP.NET we can create it easily through generic handlers. By using XmlTextWriter class, we can create XML file and XmlTextReader class we can read XML file. In this article, I will use XmlTextReader class to read it.

Complete Source Code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReadRss.aspx.cs" Inherits="ReadRss" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <asp:Button ID="Button1" runat="server" Text="Read Rss" OnClick="Button1_Click" Width="163px" />
        <asp:Repeater ID="Repeater1" runat="server">
                            <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("Title")%>'/>

                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("Description") %>'/>



CodeBehind File

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;

public partial class ReadRss : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)

    protected void Button1_Click(object sender, EventArgs e)
        WebRequest request = WebRequest.Create("http://localhost:11973/Handler.ashx");
        WebProxy proxy = new WebProxy("http://localhost:11973/Handler.ashx", true);
        request.Proxy = proxy;
        request.Timeout = 6000;
            WebResponse response = request.GetResponse();
            XmlTextReader xmlreader = new XmlTextReader(response.GetResponseStream());
            DataSet ds = new DataSet();
            Repeater1.DataSource = ds.Tables[2];
       catch(Exception ex)
            throw ex;
ASP.NET RSS Feeds Display | Get ASP.NET RSS Feeds Display | Get Reviewed by Jacob Lefore on December 29, 2015 Rating: 5

No comments