Archive for category Silverlight

Quickly implementing an RSS feed in ASP

Recently I was working on providing and consuming an RSS feed for a Silverlight project. One of the handy (but often overlooked) things possible with asp.net is the ability to set the content type at the page level. So using that trick along with a SqlDataSource and a repeater, you can put together a RSS feed (admittedly a very simple one) in as single aspx file – no code behind needed.

<%@ Page Language="C#" ContentType="text/xml" %>

<asp:repeater runat="server" DataSourceId="sdsFeed">
    <HeaderTemplate>
        <rss version="2.0">
            <channel>
                <title>QuickRss Test Feed</title>
                <link>http://quisitive.net/feed</link>
                <description>This is the feed description.</description>
    </HeaderTemplate>
    <ItemTemplate>
        <item>
            <title><%# Eval("title") %></title>
            <description><%# Eval("description") %></description>
            <pubdate><%# Eval("pubdate") %></pubdate>
        </item>
    </ItemTemplate>
    <FooterTemplate>
            </channel>
        </rss>
    </FooterTemplate>
</asp:repeater>

<asp:SqlDataSource ID="sdsFeed" runat="server"
    ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    SelectCommand="SELECT title, description, pubdate FROM rssData">
</asp:SqlDataSource>

Calling the page above results in the following simple RSS feed.

Resulting RSS data

Although this is not exactly a Silverlight tip, it may come in handy.

Silverlight Tests

I have been doing some work using Microsoft Silverlight over the last few days for a number of different projects.  This post is simply a test to see if I can get a few simple applications working through my current web host.

While the links to Silverlight applications seem to be working well, I am still working on getting the Silverlight plugin recently posted by Tim Heuer configured for my site.

UPDATE (1 Apr 09): I have figured out how to work with the Silverlight plugin recently posted by Tim Heuer on my site.  I think the settings that I chose for my permalink style may have been interfering with the xap path in the plug in options.  If I left the standard root location alone [./] and put the full path in the markup, everything worked as expected.

UPDATE 2 (2 Apr 09): But, only if it is on the main page… Following the permalink to the post will not load the app correctly.  Back to the drawing board.  I know it must be something with the path(s)…

UPDATE 3 (5 Apr 09): By putting the fully qualifed path in the markup, it seems to work both on the home page and the permalink.