×

First time here?

You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting!

So you want to read an RSS/Atom feed on the interwebs and saw the SyndicationFeed class you could use in Silverlight to give a nice RIA display of the syndicated data.  Great, no problem right, just wire up an WebClient, point it to the RSS feed on something like http://silverlight.net or something and boom, done.  Wait, what’s this 404 Not Found error?  In most cases this is going to be a result of a cross-domain issue.  If you haven’t started working with services yet, Silverlight requires a cross-domain policy file to be in place to access remote data not on the same site-of-origin of the Silverlight application.

If you want to learn more about this in further detail you can read this and view this.

Crap.  So now what do you do?  You don’t have a server that would enable you to write a proxy service and you don’t really have the time to do that.  Aha, enter some free services for you!

Popfly

First, depending on what you are trying to do with the data, give Popfly a look.  Popfly contains several templates for importing syndicated information and displaying it in different visualizations.  For instance in about 4 clicks I can import an RSS feed, connect it to a visualizer and have this:

Popfly is no longer available as a service from Microsoft.

Feedburner and Yahoo! Pipes

Pipes is similar to Popfly but doesn’t really provide a breadth of possibilities of visualizations and ease of mashup of way different types of sources, but for this purpose I think it works well.  In Pipes, you can create an input feed and map it to an output, even merging various sources together.  The end result can be a new RSS feed for you.  And Yahoo Pipes already has a cross-domain policy file in place for Flash (which Silverlight supports).  You have to change your endpoint URI a little bit and it wasn’t clear until I searched, but for example, here is a RSS feed URL you could use for combining my blog and the Silverlight community blogs in one.

Feedburner is a syndication service that does a lot of statistics of your feed, helps you manage subscriber data and can save you some bandwidth as well.   It does RSS really well (and enclosure support, etc).  Best of all, it also supports cross-domain policies via the Flash format (again, which Silverlight supports). 

So if you find a feed that is on a site without cross-domain policy support, you can create a new Feedburner feed, Yahoo Pipe or Popfly mashup and be good to go!

A subtle workaround for getting data from sites that aren’t providing the policy files :-)

Hope this helps!


This work is licensed under a Creative Commons Attribution By license.


6/4/2008 1:52 AM | # re: Reading data and RSS with Silverlight and no cross-domain policy
There are two other ways around this as well. proxy services on your local server i.e. a php, aspx, python, ruby etc script that can grab the data for you (flash has the same cross domain policy issue) or just fake it out with a policy file injectoin or use a nocrossdomain policy proxy online.

This dude did some work with this as well: http://franksworld.com/blog/archive/2008/04/17/10907.aspx
6/4/2008 7:14 AM | # re: Reading data and RSS with Silverlight and no cross-domain policy
@ryan: yes, you can definitely write your own proxies, etc. -- i was hoping to point out that if you wanted a 'no additional code' approach you can do one of these options without having to write any additional code.
6/4/2008 10:42 AM | # re: Reading data and RSS with Silverlight and no cross-domain policy
Hey Tim,

Yeh I figured that but I think that doing this directly from Flash or Silverlight always runs into problems, especially when you don't control the end point. i.e. if you are aggregating feeds, hitting lots of services etc. I was just adding to your good info in case anyone was looking. I know you have mentioned this stuff before here as well.

I am pretty amazed though that people still have so many problems with cross domain and it should really be avoided with a proxy or architecture that can include a proxy as a fallback within the system.

Great stuff on Silverlight 2 lately. I am really digging the skinning info.
9/30/2008 3:05 PM | # re: Reading data and RSS with Silverlight and no cross-domain policy
11/16/2008 9:42 PM | # re: Reading data and RSS with Silverlight and no cross-domain policy
Is it possible to have a link of code download ?

As I want to create RSS Feed, but I don't know how exactly I can do this.
11/17/2008 5:44 AM | # re: Reading data and RSS with Silverlight and no cross-domain policy
ankit: Please see silverlight.net/learn/learnvideo.aspx?video=65672 for some sample code and walk-through.
1/10/2009 4:48 PM | # re: Reading data and RSS with Silverlight and no cross-domain policy
I can't get Silverlight to work with Pipes.yahooapis.com. What am I missing? Same code works fine with say Digg API. Crossdomain.xml for the two sites is slightly different.
2/22/2009 12:24 PM | # re: Reading data and RSS with Silverlight and no cross-domain policy
I encounter the same problem as Steve, the call to pipes.yahooapis.com runs into a security error, whereas everything is fine with Digg. Somwhere else I read, that this might be because the yahooapis crossdomain.xml only supports https and not http. But all the examples I see with yahoopipes, for example Jonas', use plain http.
2/22/2009 2:43 PM | # re: Reading data and RSS with Silverlight and no cross-domain policy
Gregor, the Pipes API is on http://pipes.yahooapis.com/crossdomain.xml and should work fine. If you can provide more sample code we can help.
3/28/2009 3:04 PM | # re: Reading data and RSS with Silverlight and no cross-domain policy
Hey Tim ,

Actually I studied a little bit the article you read and went also through the posts.I am trying to write an RSS Feed in Silverlight and I got stuck into the cross-domain problem.I saw one solution using pipes yahoo API (also an example in the comment section) but I also saw you said it is possible to use FeedBurner. I looked over the API descriptions and did not quite find what I was looking for ( burning an external feed which I cannot access with my app because of the cross domain policy) .I wanted to ask you if you are sure this can be done via FeedBurner and also if you have any example of how can I do this.

Thanks a lot,
Ionut
4/11/2009 1:24 PM | # re: Reading data and RSS with Silverlight and no cross-domain policy
Hi Tim ,

I was curios if you have any experience of how to write and use a proxy for avoiding this cross domain problem or if you know about anyone who managed to do that.
Thanks a lot
4/13/2009 11:13 AM | # re: Reading data and RSS with Silverlight and no cross-domain policy
Ionut - people have been using the methods above for RSS easily. As to what you're asking, you would just write a web service that calls the other web service. That way *your* service controls the policy required then for Silverlight/Flash.
7/29/2009 2:58 PM | # re: Reading data and RSS with Silverlight and no cross-domain policy
WebClient c = new WebClient();
c.OpenReadCompleted += new OpenReadCompletedEventHandler(c_OpenReadCompleted);
c.OpenReadAsync(new Uri(url));

url = pipes.yahoo.com/.../pipe.run

on checking for e.Error the error is not null but gives a security exception.

Am I doing anything wrong here?
7/29/2009 3:06 PM | # re: Reading data and RSS with Silverlight and no cross-domain policy
Johan -- make sure you are running in a an HTTP context (address bar isn't c:\)
7/30/2009 4:57 AM | # re: Reading data and RSS with Silverlight and no cross-domain policy
Tim, thanks, but I must admit that I am slightly confused.

Are you talking about the URI?
The url I am useing is the one I posted in my comment above, that points to a pipes address on yahoo.

I am still rather new to this...
7/30/2009 8:38 AM | # re: Reading data and RSS with Silverlight and no cross-domain policy
Johan -- I'm talking about the URI in the browser when you are running the silverlight application.
11/30/2009 6:28 AM | # re: Reading data and RSS with Silverlight and no cross-domain policy
Tim, Thanks this works fine. But I am trying to integrate some of the company news feed and they do not return any items when I append the pipes code. (If I do not add Pipes code, they give me security exception). Anything that I am missing?
Here are some sample sites that I tried:

www.google.com/.../company_news

news.moneycentral.msn.com/.../rcnews.aspx
11/30/2009 9:51 AM | # re: Reading data and RSS with Silverlight and no cross-domain policy
Make sure you are using the right yahoo pipes API url (one of them doesn't have the cross domain policy file)

 
Please add 6 and 8 and type the answer here:

DISCLAIMER:

The opinions/content expressed on this blog are provided "ASIS" with no warranties and are my own personal opinions/content (unless otherwise noted) and do not represent my employer's view in any way.