HowTo: Use PicLens and other MediaRSS Clients for your own Website (create MediaRSS with LINQ to XML)

This blogpost is related to the "RSS XLINQ" post – but this time the result will be cooler ;).

About this post
This post is about the "MediaRSS" standard and how you can use it for your own website. If you have never heard of it – never mind. But maybe you have heard of a really cool Firefox Plugin called "PicLens".


"PicLens" is a incredible surface for some internet services, like YouTube, Google picture search, Flickr or Amazon:

This is the Amazon-Surface:


Media RSS
The Piclens guys have implemented the "MediaRSS" standard – that means: Each site with an MediaRSS can be viewed in Piclens. 
If you are a webmaster, you should take a look at this site. We created in the last post an RSS feed with XLinq – MediaRSS shouldn´t be much harder to code:


We have the same project files – only the RSS generation must be changed:

        XNamespace media = "";
        XNamespace atom = "";
        public void ProcessRequest(HttpContext context)

            XDocument document = new XDocument(
                                    new XDeclaration("1.0", "utf-8", "yes"),
                                    new XElement("rss",
                                        new XAttribute("version", "2.0"),
                                        new XAttribute(XNamespace.Xmlns + "media", media),
                                        new XAttribute(XNamespace.Xmlns + "atom", atom),
                                        new XElement("channel", this.CreateElements())

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

        private IEnumerable<XElement> CreateElements()
            List<XElement> list = new List<XElement>();

            for(int i = 1; i < 100; i++)
                XElement itemElement = new XElement("item",
                                            new XElement("title", i),
                                            new XElement("link", ""),
                                            new XElement(media + "thumbnail", 
                                                new XAttribute("url", "" + i + ".png")),
                                            new XElement(media + "content",
                                                new XAttribute("url", "" + i + ".png"))

            return list;

This time we need 2 XNamespaces – "media" and "atom" are need to create a valid MediaRSS:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:media="" xmlns:atom="">

These namespaces must be added by using the XAttribute class. The syntax is in my point of view a bit to complex, but I didn´t  find a better way. 

The source code above is everything you need to create a "simple" MediaRSS – there are some other elements supported by piclens – look at the Guide for more information.


We created the RSS auto-detection in the last blogpost. Piclens can now find the MediaRSS elements and show us the pictures on the "Wall" (the Piclens-Button glow if it find a MediaRSS Feed on the site) :


If you have several pictures on your site – publish a MediaRSS Feed. It´s very easy and it´s an open standard (Specification @ Yahoo) – Piclens is just one MediaRSS Client (but today the client with the best surface).

[ Download Source Code ]

PS: I use my german blog as the picture source – please don´t abuse this example (traffic :( ) ;)

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

About the author

Written by

Currently there is no additional info about this author.

Recent Posts

  • HowTo: make out Retweet-counter in a random URL

      Twitter offers some interesting functions with the integration of the twitter button – every user can see how often the website has been retweeted and he can do the same with just one click. But of course the whole thing has his price: - The integration of the Twitter JavaScript makes the whole data […]

  • Time-controlled Azure WebJobs – Azure as easy as it get‘s

        While still in development the Azure WebJob SDK offers some cool features for procession and supply of information. A good example is the sample that observes the Azure Queue and processes an item as soon as it spots one.   Scenario: time-controlled activities – without queue and so on My scenario was quite […]

  • image2021-570x194_thumb.png
    HowTo: Create RSS Feeds with ASP.NET MVC

    I’ve already written about how to consume RSS or Atom Feeds with the SyndicationFeed (in German, sry) but todays post is about how to create or publish an own feed. Beside the age of the feed standard and the much defamation from Facebook, Twitter and Google on RSS/Atom I consider this easy to consume API […]

  • image1997-311x194_thumb.png
    How to access an Azure Website with the local IIS Manager

    Since the end of February it is possible to access an Azure Website with the IIS Manager. Although the Azure Management site offers some information there are more details visible at the IIS Manager. For the connection you will need an IIS Manager and the IIS Manager for Remote Administration Extension. It’s also possible to […]

  • image1929-570x143_thumb.png
    Create and validate own Json-Web-Tokens (JWTs)

    If you are interested in web authentication you probably have heard about JSON Web tokens (JWT). What is a JWT? Maybe I’m not using the correct security termination but however: JWTs are used to exchange claims between two systems. For example: You want to log on to a service (like Facebook, Twitter, etc.) and want […]

Support us