One of the tricks people are doing these days with RSS is to
enable people to subscribe to feeds that are personalized for them. They often
do this by adding a query-string parameter to the RSS feed that contains a
unique identifier to map the URL to a specific account name on the server
(allowing a user for example to publish and subscribe to their private calendar
or task-list or contact-list information).
The RSS Toolkit allows you to easily build these types of
apps and integrate them with the ASP.NET membership and authentication system.
Note how in the handler above there is a “username” parameter to the
PopulateChannel method. ASP.NET will look for an encrypted username value on
the incoming RSS feed URL, and automatically decrypt and pass the username to
this method when it is supplied (you could then write code within this method
to hit a database and pull back only the items for that particular user).
To embed the encrypted user-name within the RSS feed URL,
you can either get the value via an API call, or generate the RSS URL link
using the new declarative RSSHyperlink control and setting the IncludeUserName=”true”
property to true:
Listing 6
<RssToolKit:RssHyperLink runat="server" IncludeUserName="True"
NavigateUrl="~/scenario6.ashx">Personalized RSS Feed Sample</RssToolKit:RssHyperLink>
When a user clicks on this feed it will include their
username encrypted within the URL. When they copy/paste the feed link into a
blog reader (for example: to subscribe to it), it will then remember the user’s
identity and allow them to always have a personalized view of the data.