Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 20th, 2008, 11:12 AM
Authorized User
 
Join Date: Jan 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rss feeds

Hi
I want to create rss feed for the news section of a website (Its a huge website and get updated on daily basis, therefore XML file creation has to be dynamic.), that is built in vb.net. As i am totally new in rss and have some basic knowledge only, Could somebody help me guide me from where to start?

Many Thanks
 
Old March 20th, 2008, 11:41 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This is fairly simple. The way I have done this in the past is to use a StringWriter and an XmlTextWriter to build the RSS document in code and then write the data out to the browser.

The file must conform to the RSS spec. Wikipedia has some pretty good information on it here: http://en.wikipedia.org/wiki/RSS_(file_format)

Some basic code would be:
StringWriter sw = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(sw);

writer.WriteStartElement("rss");
writer.WriteAttributeString("version","2.0");

//Write channel description info here

//Write item elements here

//End item Elements
//End Channel elements

writer.WriteEndElement();
writer.Flush();
writer.Close();
Response.Write(sw.ToString());
sw.Close();
Response.End();


hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old March 20th, 2008, 11:51 AM
Authorized User
 
Join Date: Jan 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi dparsons

Basically for the website to which i am going to built is for its News sections. Hence what i have understand so far is first I have to create a dynamic xml file in code ("let say consists top 5 news ) and then just output the file in xml format. RIGHT?

Many thanks for the reply...
 
Old March 20th, 2008, 02:07 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You could put the code from my previous post into a regular aspx page and RSS readers would still be able to interpert the data since calling Response.Write() would simply pass a bunch of XML to the Response Stream. So you don't really output a file, you output XML syntax.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Rss feeds SKhna ASP.NET 2.0 Basics 0 April 17th, 2008 05:00 AM
Chapter 5 RSS Feeds NEO1976 BOOK: Professional Ajax ISBN: 978-0-471-77778-6 3 October 20th, 2006 11:34 PM
RSS Feeds with JavaScript NEO1976 Javascript How-To 0 October 6th, 2006 09:13 AM
RSS feeds from the forum? javatis Forum and Wrox.com Feedback 1 February 2nd, 2006 03:44 PM
RSS Feeds harpua PHP How-To 4 October 21st, 2005 09:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.