By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,212 Members | 2,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,212 IT Pros & Developers. It's quick & easy.

RSS feed <> sql server <> aspx <> xml <> blog

P: n/a
I have been researching articles on google on how to create a simple RSS
feed that sucks <title><blurb><link><date> out of a sql server 2000 database
via an aspx page.

I know it has to be pushed into a <xml> document but not sure which
direction to take.

Is there perhaps a starter document which uses sql server as the data source
I can tap into.

I am a newbie to aspx but I it appears there is a lot of inbuilt support for
this application and I don't wish to go down to many wrong paths or reinvent
the wheel.

Any advice appreciated!


ps: It appears that <rss> is tied in heavily with <blogs> these
anyone come up with a combined solution?
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
Here's the meat of the the rss.aspx that I use for As
you can see, it's just a single repeater dumping out XML instead of
HTML. Couldn't be much simpler, though you'll need to remember to set
the ContentType on the server:

Page.Response.ContentType = "text/xml";

<?xml version="1.0" ?>
<rss version="2.0"
<title> - Livin' large in the third world</title>
<description>Travel journals and photo blogs from world travellers.
Maps, research and resources for the aspiring vagabond.</description>
<copyright>Copyright 2005,</copyright>
<asp:Repeater ID="rptComments" Runat=server>
<title><%# DataBinder.Eval(Container.DataItem,
<description><![CDATA[<%# GetDescription(
DataBinder.Eval(Container.DataItem, "CommentText"),
DataBinder.Eval(Container.DataItem, "UserID") )%>]]></description>
<author><%# GetAuthorName( DataBinder.Eval(Container.DataItem,
"UserID") )%></author>
<category><%# GetLocationName( DataBinder.Eval(Container.DataItem,
"LocationID") )%></category>
<pubDate><%# GetPubDate( DataBinder.Eval(Container.DataItem,
"CommentDate") )%></pubDate>
DataBinder.Eval(Container.DataItem, "TripID")%></link>
DataBinder.Eval(Container.DataItem, "CommentID")%></guid>

Jason Kester
Expat Software Consulting Services

Get your own Travel Blog, with itinerary maps and photos!

Nov 19 '05 #2

P: n/a
Dude, awesome - its been a long time since anyone has posted a full set of
example code for an inept <newbie /> such as myself. :)) Thanks!!

My first stupid question:

I sucked your code into aspx container page in web matrix (free) and tried
executing and obviously it generates a compile error with regards the
content type.

How do I actually insert the content type onto the page below?

I have done some searches on 'content type examples text/xml'.

I pick up a compilation error when I add this to the page:

<%Page ContentType="Text/Xml">

What am I doing wrong?

Nov 19 '05 #3

P: n/a
That needs to live on the codebehind (or possibly in a <script
runat=server> if you're not using codebehinds). Here is a small chunk
of mine. Obviously you'll need to generate your own dataset to bind
the repeater, and you'll need to write your own helper functions to
format dates and HtmlEntityEncode strings:

protected Repeater rptComments;

private void Page_Load(object sender, System.EventArgs e)
Page.Response.ContentType = "text/xml";

DataView dv = TripReportComment.List().Tables[0].DefaultView;
dv.Sort = Comment.Columns.CommentDate + " desc";

rptComments.DataSource = dv;


Jason Kester
Expat Software Consulting Services
Get your own Travel Blog, with itinerary maps and photos!

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.