output RSS with ASP

I

istalcup

Hi,
I am dynamically creating a RSS File by pulling title, summary, etc
information from a database of our html products using ASP.

When I put the link to this ASP in a feed reader, it does work..but
when I run the ASP it shows nothing on the screen. My boss would like
the warm and fuzzy where when you click on it you can see the whole XML
tree.

How can I make response.write show information on the screen and treat
it like and rss file?

thanks!
 
M

Martin Honnen

I am dynamically creating a RSS File by pulling title, summary, etc
information from a database of our html products using ASP.

When I put the link to this ASP in a feed reader, it does work..but
when I run the ASP it shows nothing on the screen. My boss would like
the warm and fuzzy where when you click on it you can see the whole XML
tree.

How can I make response.write show information on the screen and treat
it like and rss file?

You should set
Response.ContentType = "application/xml"
then I guess, the problem is likely that you use application/rss+xml
which is the proper content type for RSS I think but unfortunately
browser don't run their default XSL pretty-print stylesheet on that
type. Perhaps it might make sense to sniff the user agent requesting the
ASP page and if you know it is a feed reader then send application/rss+xml.
 
A

Andy Dingley

When I put the link to this ASP in a feed reader, it does work..but
when I run the ASP it shows nothing on the screen.

Tell us the URL if you expect us to be able to help.

It sounds like the HTTP content-type returned isn't being set and ASP is
returning the default of text/html. As you're not sending any HTML, the
browser is ignoring it. As the feed reader _only_ understands RSS, then
it does a silent error-fix and treats it as RSS anyway.

Try setting

Response.ContentType = "application/rss+xml"

or maybe
Response.ContentType = "text/xml"

The second is favoured for browsers and anything that doesn't "look like
a feed reader", but the Accept string isn't reliable here. If in doubt,
use the second.


And don't use Response.Write () There are better ways.

My boss would like
the warm and fuzzy where when you click on it you can see the whole XML
tree.

Perhaps a better idea is that if a browser connects (i.e. something that
favours text/html in its Accept string) then you can return your RSS
with a link to a simple client-side XSLT stylesheet (also on your
server). This won't break a feed reader, but it can make random human
accesses more easily readable.
 
I

istalcup

Thank you both for your help! I can't give you the URL because it
resides on a government LAN, which you don't have access to.
I will try Response.ContentType = "text/xml" and should get this
working shortly!
Also in the near future I am sure I will have to do some filtering...
do you know of a URL that I can get more information about RSS
(pertaining to what I am trying to do). I have gone to many websites
that only explain making an RSS file manually. I believe I will soon
have to implement filtering capability. For example, if someone puts
in http://www.thesite.com/rssfeed.asp?Filter=Florida then they would
subscribe to all of our products with Florida in the title...
Thanks again for any help you are able to provide!
 
A

Andy Dingley

Also in the near future I am sure I will have to do some filtering...
do you know of a URL that I can get more information about RSS
(pertaining to what I am trying to do).

No, this just isn't an RSS problem. It sounds like standard database
filtering work - any guidance on doing this for direct output to HTML
ought to help you out.

As one little hint, don't filter XML. Use a SQL database, that's what
they're there for. Although it's very easy to _code_ a solution that
extracts "everything" as XML, then uses simple XSLT to filter it down to
"15 items" for an RSS output, the performance will be slow.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top