Simple Javascript/ASP.NET RSS Aggregator that can read internal RSS feeds

jwshome
jwshome used Ask the Experts™
on
I'm developing an internal website for my company, and I've been asked to include RSS feeds from our internal blog (hosted on a computer at the office) and an external blog (online). I really don't have any web development experience, so normally I'd turn to a free service that deals with the "translation" off-site and gives me a nice piece of Javascript that I can just copy onto my site; unfortunately, my company doesn't want me to publish the internal RSS feed to the web, which eliminates that option.

I've tried a number of different ASP and Javascript solutions that I've found online, but I haven't gotten any of them to work in IE7 (the browser the company uses). Does anyone have a recommendation (or, better, a piece of code) where I can just copy it into my website, change the location of the feeds, and put it online?

So far, my best attempt has been with this:
http://ajax.phpmagazine.net/2005/11/ajax_rss_reader_step_by_step_t.html
which seems to work in Firefox but not in IE7, and I can't figure out how to get it it to work with feeds that aren't hosted locally...

Thanks for your help!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hi. I have used the following example for IE7 and it works well for both live and on-site rss feeds.



<%@ Page Language="VB" Debug="False" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Xsl" %>
<%@ OutputCache Duration="3600" VaryByParam="none" %>
<script language="VB" runat=server>

  Sub Page_Load(sender As Object, e As EventArgs)

    ' Using a live RSS feed... could also use a cached XML file.
    Dim strXmlSrc  As String = "http://www.megatokyo.com/rss/megatokyo.xml"
    'Dim strXmlSrc As String = Server.MapPath("megatokyo.xml")

    ' Path to our XSL file.  Changing the XSL file changes the
    ' look of the HTML output.  Try toggling the commenting on the
    ' following two lines to give it a try.
    Dim strXslFile As String = Server.MapPath("megatokyo.xsl")
    'Dim strXslFile As String = Server.MapPath("megatokyo2.xsl")

    ' Load our XML file into the XmlDocument object.
    Dim myXmlDoc As XmlDocument = New XmlDocument()
    myXmlDoc.Load(strXmlSrc)

    ' Load our XSL file into the XslTransform object.
    Dim myXslDoc As XslTransform = New XslTransform()
    myXslDoc.Load(strXslFile)

    ' Create a StringBuilder and then point a StringWriter at it.
    ' We'll use this to hold the HTML output by the Transform method.
    Dim myStringBuilder As StringBuilder = New StringBuilder()
    Dim myStringWriter  As StringWriter  = New StringWriter(myStringBuilder)

    ' Call the Transform method of the XslTransform object passing it
    ' our input via the XmlDocument and getting output via the StringWriter.
    myXslDoc.Transform(myXmlDoc, Nothing, myStringWriter)

    ' Since I've got the page set to cache, I tag on a little
    ' footer indicating when the page was actually built.
    myStringBuilder.Append(vbCrLf & "<p><em>Cached at: " _
        & Now() & "</em></p>" & vbCrLf)

    ' Take our resulting HTML and display it via an ASP.NET
    ' literal control.
    litMegaTokyoRssHtml.Text = myStringBuilder.ToString

  End Sub

</script>
<html>
<head>
  <title>ASP 101's ASP.NET MegaTokyo RSS Feed Reader</title>
</head>
<body>

<asp:Literal id="litMegaTokyoRssHtml" runat="server" />

</body>
</html>

megatokyo.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" />

  <xsl:template match="/">
    <xsl:for-each select="rss/channel/item">
      <p>
      <a href="{link}"><strong><xsl:value-of select="title" /></strong></a>
      <xsl:value-of disable-output-escaping="yes" select="description" />
      </p>
      <hr />
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>


megatokyo2.xsl

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" />

  <xsl:template match="/">

    <xsl:for-each select="rss/channel">
      <h2><a href="{link}"><xsl:value-of select="title" /></a></h2>
    </xsl:for-each>

    <ul>
      <xsl:for-each select="rss/channel/item">
        <li><a href="{link}"><strong><xsl:value-of select="title" /></strong></a></li>
      </xsl:for-each>
    </ul>
  </xsl:template>

</xsl:stylesheet>


Please give this a try and get back to me.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial