6
12/22/13 how to Create RSS feed Using Asp.net | RSS Feed Sample using asp.net - ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview,SQL Server,Ajax,SSR… www.aspdotnet-suresh.com/2010/04/creating-rss-feed-using-aspnet-with-c.html#more 1/6 9.6k Like Like Follow Follow @aspdotnetsuresh @aspdotnetsuresh 3,090 ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview,SQL Server,Ajax,SSRS, XML examples aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies HOM E ASP.NET AJAX GRIDVIEW JAVASCRIPT SQL JQUERY OOPS CONCEPTS INTERVIEW QUESTIONS TRACE MOBILE NUMBER ADVERT how to Create RSS feed Using Asp.net | RSS Feed Sample using asp.net By: Suresh Dasari Apr 3, 2010 Categories: Asp.net , General , RSSFeeds Introduction: Here I will explain how to create RSS feed using asp.net. Description : RSS stands for "Really Simple Syndication". RSS solves a problem for people who regularly use the web. It allows you to easily stay informed by retrieving the latest content from the sites you are interested in. You save time by not needing to visit each site individually. To implement RSS feed concept using asp.net just follow below steps Step 1: Create Table In tblRss SQl Server as below. ColumnName DataType ID int Title varchar(50) Description varchar(50) Url Varchar(50) Step 2: Insert the Data In to the tblRss some Dummy data Url must be related Rss Link just like this ID Title Description Url 1 Test testing http://aspdotnet-suresh.com 2 aspdotnet aspdotnet-suresh http://aspdotnet-suresh.com Step 3: In Default.aspx page add these 2 lines of code. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ OutputCache Duration="120" VaryByParam="*" %> Step4: In code behind using System; using System.Data; using System.Data.SqlClient; using System.Text; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Xml; public partial class GridviewEditUpdate : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string connectionString = "Data Source=MYCBJ017550027;Initial Catalog=MySamplesDB;Integrated Security=True" ; DataTable dt = new DataTable(); SqlConnection conn = new SqlConnection(connectionString); using (conn) { SqlDataAdapter ad = new SqlDataAdapter("SELECT * from tblRSS" , conn); ad.Fill(dt); } Search This Site Search About Me SURESH DASARI TENALI, ANDHRA PRADESH, INDIA Hi i am suresh dasari,softwa engineer working on asp.net,c#.net,SQL Server. VIEW MY COMPLETE PROFILE Follow Follow @aspdotnetsuresh @aspdotnetsuresh 3,090 f ollow ers 9.6k Like Like 3 Select Language Pow ered by Translate Book Your Air Ticket Round Trip One Way *Conditi Going To: Leaving From: Passenger 1 Depart Date: Return Date: 22 Dec 2013 Dec 2013 22 --------------- --------------- ? Tweet Tweet 1 3 S 1 Sorry, Share Share Aspdotnetsuresh 9,625 people like Aspdotnetsuresh. Facebook social plugin Like Like

How to Create RSS Feed Using ASP.net _ RSS Feed Sample Using ASP.net - ASP.net,C#.NET,VB

Embed Size (px)

DESCRIPTION

This tutorial we can learn how to create RSS Feed using asp.net

Citation preview

Page 1: How to Create RSS Feed Using ASP.net _ RSS Feed Sample Using ASP.net - ASP.net,C#.NET,VB

12/22/13 how to Create RSS feed Using Asp.net | RSS Feed Sample using asp.net - ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview,SQL Server,Ajax,SSR…

www.aspdotnet-suresh.com/2010/04/creating-rss-feed-using-aspnet-with-c.html#more 1/6

9.6kLikeLike Follow Follow @aspdotnetsuresh@aspdotnetsuresh 3,090 follow ers

ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview,SQLServer,Ajax,SSRS, XML examplesaspdotnet-suresh offers C#.net articles andtutorials,csharp dot net,asp.net articles andtutorials,VB.NET Articles,Gridview articles,codeexamples of asp.net 2.0 /3.5,AJAX,SQL ServerArticles,examples of .net technologies

HOME ASP.NET AJAX GRIDVIEW JAVASCRIPT SQL JQUERY OOPS CONCEPTS INTERVIEW QUESTIONS TRACE MOBILE NUMBER ADVERTISE

how to Create RSS feed Using Asp.net | RSS Feed Sample usingasp.netBy: Suresh Dasari Apr 3, 2010

Categories: Asp.net , General , RSSFeeds

Introduction:

Here I will explain how to create RSS feed using asp.net.

Description:

RSS stands for "Really Simple Syndication". RSS solves a problem for people who regularly use the web. It

allows you to easily stay informed by retrieving the latest content from the sites you are interested in.

You save time by not needing to visit each site individually.

To implement RSS feed concept using asp.net just follow below steps

Step 1: Create Table In tblRss SQl Server as below.

ColumnName DataType

ID int

Title varchar(50)

Description varchar(50)

Url Varchar(50)

Step 2: Insert the Data In to the tblRss some Dummy data Url must be related Rss Link just like this

ID Title Description Url

1 Test testing http://aspdotnet-suresh.com

2 aspdotnet aspdotnet-suresh http://aspdotnet-suresh.com

Step 3: In Default.aspx page add these 2 lines of code.

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

<%@ OutputCache Duration="120" VaryByParam="*" %>

Step4: In code behind

using System;

using System.Data;

using System.Data.SqlClient;

using System.Text;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Xml;

public partial class GridviewEditUpdate : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

string connectionString = "Data Source=MYCBJ017550027;Initial Catalog=MySamplesDB;Integrated

Security=True";

DataTable dt = new DataTable();

SqlConnection conn = new SqlConnection(connectionString);

using (conn)

{

SqlDataAdapter ad = new SqlDataAdapter("SELECT * from tblRSS", conn);

ad.Fill(dt);

}

Search This Site

Search

About Me

SURESH DASARI

TENALI, ANDHRA PRADESH, INDIA

Hi i am suresh dasari,software

engineer working on

asp.net,c#.net,SQL Server.

VIEW MY COMPLETE PROFILE

Follow Follow @aspdotnetsuresh@aspdotnetsuresh 3,090 follow ers

9.6kLikeLike

3

Select Language

Pow ered by Translate

Book Your Air Ticket

Round Trip One Way

*Conditions apply

Going To:Leaving From: Passengers:

1

Depart Date: Return Date:

22 Dec 2013 Dec 201322

--------------- ---------------

?

TweetTweet

1

3

StumbleUpon1

Sorry, something went wrong.

ShareShare

Aspdotnetsuresh

9,625 people like Aspdotnetsuresh.

Facebook social plugin

LikeLike

Page 2: How to Create RSS Feed Using ASP.net _ RSS Feed Sample Using ASP.net - ASP.net,C#.NET,VB

12/22/13 how to Create RSS feed Using Asp.net | RSS Feed Sample using asp.net - ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview,SQL Server,Ajax,SSR…

www.aspdotnet-suresh.com/2010/04/creating-rss-feed-using-aspnet-with-c.html#more 2/6

Response.Clear();

Response.ContentType = "text/xml";

XmlTextWriter TextWriter = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);

TextWriter.WriteStartDocument();

//Below tags are mandatory rss

TextWriter.WriteStartElement("rss");

TextWriter.WriteAttributeString("version", "2.0");

// Channel tag will contain RSS feed details

TextWriter.WriteStartElement("channel");

TextWriter.WriteElementString("title", "C#.NET,ASP.NET Samples and Tutorials");

TextWriter.WriteElementString("link", "http://aspdotnet-suresh.blogspot.com");

TextWriter.WriteElementString("description", "Free ASP.NET articles,C#.NET,ASP.NET tutorials and

Examples,Ajax,SQL Server,Javascript,XML,GridView Articles and code examples -- by Suresh Dasari");

TextWriter.WriteElementString("copyright", "Copyright 2009 - 2010 aspdontnet-suresh.blogspot.com. All

rights reserved.");

foreach (DataRow oFeedItem in dt.Rows)

{

TextWriter.WriteStartElement("item");

TextWriter.WriteElementString("title", oFeedItem["Title"].ToString());

TextWriter.WriteElementString("description", oFeedItem["Description"].ToString());

TextWriter.WriteElementString("link", oFeedItem["URL"].ToString());

TextWriter.WriteEndElement();

}

TextWriter.WriteEndElement();

TextWriter.WriteEndElement();

TextWriter.WriteEndDocument();

TextWriter.Flush();

TextWriter.Close();

Response.End();

}

}

Demo

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our

Facebook, Twitter, RSS feed, or by email.

9.6kLikeLike 3 Subscribe by RSS Subscribe by Email

Follow Follow @aspdotnetsuresh@aspdotnetsuresh 3,090 follow ers

?

Recent Posts

jQuery Set Maxlength for Multiline Textbox inAsp.netMore »

jQuery Set Maximum Length to Textarea orjQuery Check Textar...More »

Call WCF Service from jQuery Ajax JSONExample in Asp.net us...More »

jQuery Slide DIV Content from Left to Right orMove DIV from...More »

jQuery Ajax JSON Example in Asp.netMore »

SQL Server - Query to Get List of Tables inDatabase in SQL ...More »

Get Table Size in SQL Server | Query to GetTable Size in SQ...More »

SQL Server - How to Get Database Size in SQLServer 2008More »

what is authorization in asp.net | authorizationrules in we...More »

C# - Difference between String andStringbuilder in C#, Asp....More »

Get Latest articles in your inbox for free.

Enter your email address:

Subscribe

?

Aspdotnet-Suresh

+ 1,550

Follow +1

Page 3: How to Create RSS Feed Using ASP.net _ RSS Feed Sample Using ASP.net - ASP.net,C#.NET,VB

12/22/13 how to Create RSS feed Using Asp.net | RSS Feed Sample using asp.net - ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview,SQL Server,Ajax,SSR…

www.aspdotnet-suresh.com/2010/04/creating-rss-feed-using-aspnet-with-c.html#more 3/6

19 comments :

Find us on Facebook

Aspdotnetsuresh

9,625 people like Aspdotnetsuresh.

Facebook social plugin

LikeLike

Tags

Asp.net General JQuery Snippets Javascript C#.Net SQL Server

Gridview VB.NET JQuery Plugins Interview

Questions Errors Ajax DropdownList validations

DatePicker Authentication Fileupload SharePoint

Membership OOPS Concepts JSON CSS Google API

IISServer CheckBox Crystal Reports Google MAPS

AutoComplete

Book Your Air Ticket

Round Trip One Way

Leaving from: Going to:

*Conditions apply

Passengers:

1

Depart Date: Return Date:

22 Dec 2013 Dec 201322

--------------- ---------------

You might also like:

Create Simple jQuery

Mobile Website

Example

JQuery lightbox

image slideshow

gallery in asp.net

How to Create a Site

in SharePoint 2010 |

Create ...

jQuery Wiki Plugin to

Show Wikipedia

Description in ...

Asp.net host

website on local

machine w ith

custom ...

SQL Server - Get List

of All Table Names in

Database

jQuery Create Read

Cookie Get Set

Delete Cookies ...

jQuery Make

Checkboxes

Checked Selected

Mode with Name

How to Clear Textbox

Value w ith jQuery

jQuery Clear Textbox

Value on focus

1

2

3

Dwayne said...

small error in your code

1) //Below tags are mandatory rss tagTextWriter.WriteStartElement("rss"); should be two lines

//Below tags are mandatory rss tag

TextWriter.WriteStartElement("rss");

2)this gave an error so I deleted it

using System.Linq;

Otherwise it works great! :)

December 31, 2010 at 6:01 PM

Suresh Dasari said...

Thanks Dwayne thanks for rectify my mistake i modified the code now it's working fine

January 17, 2011 at 5:40 PM

chinuexpert said...

hey hi,

i create an application by following above procedure & steps but on front page i.e. on aspx page which control we

should use to display rss feeds? plz tell me it's important for me.

December 27, 2011 at 9:12 PM

SendMail ExcelSheet InternetTips

AjaxModalPopupExtender ExportGridview Data Menu

Joins SlideShow WCF Window s Application XML

Modalpopup WebService CheckBoxList Dynamic Controls

Facebook Global.asax Tw itter Window s Service YouTube

jQuery Menu jQuery UI Accordion Menu AjaxAsyncFileUpload

EncryptionandDecryption LightBoxEffect Polymorphism

Progressbar Visual Studio ZIP UNZIP Files w eb.config

Degree View Plugins AjaxAutoCompleteExtender

AjaxTabContainer Average rating Blog Statistics Cookie

Header on Scroll Flip Effect KeyBoard Key Codes

Multi l ineTextbox News Ticker in jQuery PDF Viewers

Session Timeout ThumbnailsGeneration UserName Check

Visitors Count jQuery Cookie jQuery Media Plugins

Image 3-TierArchitecture ADO.NET AbstractVsInterface

ActiveDirectory Advertise Ajax Calendarextender

ConfirmbuttonExtender AjaxAccordionControl

AjaxCalendarExtender AjaxCollapsiblePanelControl

AjaxDragPanelExtender AjaxPasswordStrength

AjaxRatingControl AjaxSlideshowExtender Arraylist Assembly

Authorization Captcha Chatting Plugins CodingStandards

Custom Right Click Menu DataGrid Generic List HTML

Address ImportContacts ListBox MCC Award Panorama Image

Viewer Plugins Print DIV Product Reviews QueryString

RSSFeeds RadioButtonList Read/Write text fi le

ReadOnlyValues Repeater Resize Image Reviews RichTextBox

SQL Constraints SiteMap Social Media Bookmark Plugins

Checker Testimonial Example Testing Trace Mobile Number

Try Catch UpdatePanel VBScript Virtual Keyboard WPF

Audio Plugins jQuery Mobile jQuery Video Plugins

top/bottom of div setInterval setTimeOut

Page 4: How to Create RSS Feed Using ASP.net _ RSS Feed Sample Using ASP.net - ASP.net,C#.NET,VB

12/22/13 how to Create RSS feed Using Asp.net | RSS Feed Sample using asp.net - ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview,SQL Server,Ajax,SSR…

www.aspdotnet-suresh.com/2010/04/creating-rss-feed-using-aspnet-with-c.html#more 4/6

4

5

6

7

8

9

10

11

12

13

14

15

Suresh Dasari said...

@chinuexpert,

No need of any control just create the page based on above process and run it output will display.

December 27, 2011 at 9:24 PM

Anonymous said...

grt work

February 20, 2012 at 11:29 PM

Anonymous said...

nice post

May 22, 2012 at 7:13 AM

Shafeeq said...

awsome you are

August 11, 2012 at 4:23 AM

Anonymous said...

Tell me something about Sharepoint also..

September 12, 2012 at 9:36 PM

Anonymous said...

i got a result in xml format

November 20, 2012 at 3:14 AM

Anonymous said...

thanx a lot sir

November 26, 2012 at 3:50 AM

Anonymous said...

This feed contains errors. Internet Explorer will try updating this feed again later.iam getting this as result.Ihave 12

rows of data but display onli one row .

November 26, 2012 at 9:18 PM

Masilamani Rajamanickam said...

my result in xml format. how can i get rss feeds

December 3, 2012 at 3:40 AM

Anonymous said...

in chrome....the result is xml format.how to get actual rss feeds

January 9, 2013 at 3:47 AM

Anonymous said...

grt post

thanks

March 17, 2013 at 3:52 PM

Janaki Lenagala said...

Hi, I want to create a RSS feed for a asp.net web page by using jquery.How should I do? please help me..

Page 5: How to Create RSS Feed Using ASP.net _ RSS Feed Sample Using ASP.net - ASP.net,C#.NET,VB

12/22/13 how to Create RSS feed Using Asp.net | RSS Feed Sample using asp.net - ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview,SQL Server,Ajax,SSR…

www.aspdotnet-suresh.com/2010/04/creating-rss-feed-using-aspnet-with-c.html#more 5/6

Newer Post Older Post

Give your Valuable Comments

Enter your comment...

Comment as: Google Account

PublishPublish

PreviewPreview

Home

Subscribe to: Post Comments ( Atom )

Other Related Posts

Asp.net

Asp.net

Move Selected Gridview Rows to Another Gridview in Asp.net - ASP ...

C# - What is Difference between Overriding and ... - Asp.net

C# - What is Delegates in C# Example | Use of Delegates ... - Asp.net

3 tier architecture example in asp.net with C#

Asp.net insert, Edit, update, delete data in gridview

Introduction to Object Oriented Programming Concepts (OOPS) in C#.net

Interview Questions in ASP.NET,C#.NET,SQL Server,.NET Framework

Introduction to WCF - WCF tutorial | WCF Tutorial - Windows Communication Foundation | WCF Example |

WCF Sample code in asp.net 3.5 | Basic WCF Tutorial for Beginners

jQuery 360 Degrees Image Display Plugins Examples with Tutorial

how to insert images into database and how to retrieve and bind images to gridview using asp.net (or)

save and retrieve images from database using asp.net

16

17

18

19

May 16, 2013 at 10:02 PM

Leslie C said...

3 years later and this code and still good. I needed a simple rss solution and this got me up and running in no

time. Thank you for the post!

September 20, 2013 at 3:58 PM

Sanjay Gupta said...

This XML file does not appear to have any style information associated with it. The document tree is shown below.

i am applying this then my output like this error

September 30, 2013 at 10:16 PM

Raj Kumar said...

Your output is generating in rss.aspx page, but i've to do generate it in xml like rss.xml. How can i achieve this?

October 2, 2013 at 7:50 PM

Sanjay Gupta said...

i want display image in rss feed.......

October 3, 2013 at 10:01 PM

Page 6: How to Create RSS Feed Using ASP.net _ RSS Feed Sample Using ASP.net - ASP.net,C#.NET,VB

12/22/13 how to Create RSS feed Using Asp.net | RSS Feed Sample using asp.net - ASP.NET,C#.NET,VB.NET,JQuery,JavaScript,Gridview,SQL Server,Ajax,SSR…

www.aspdotnet-suresh.com/2010/04/creating-rss-feed-using-aspnet-with-c.html#more 6/6

Simple login form example in asp.net Check Username and Password availability in database

Asp.net WebService or Creating and Consuming WebService in asp.net or Create and call webservice in

asp.net or how to create webservice and how to use webservice in asp.net

Ajax ModalPopUpExtender Example to edit the gridview row values in asp.net

?

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.

The content is copyrighted to Suresh Dasari and may not be reproduced on other w ebsites w ithout permission from the ow ner.