What is RSS?
RSS (acronymic for Really Simple Syndication) is "a group of XML based
web-content distribution and republication (Web syndication) formats
primarily used by news sites and weblogs (blogs)." Essentially, an RSS
feed is a hosted XML file from which your RSS newsreader pulls
headlines, URLs, and other content as it is updated.
In Simple words you are trying to access a page from different domain from your's...Most
of the time you'll see this exception when your Silverlight application
is accessing a service not hosted on the same application domain. This
is considered cross-domain access and requires the service host to enable an opt-in policy file so rich client platforms are allowed to access the service. In Silverlight we call that the clientaccesspolicy.xml file.
So generally the sites like sun.com,oracle.com,cisco.com dont give
permissions for crossdomain calls,they only allow you to subscribe for
So I have found two solutions.
1)Use a proxy.which grants you permission and has a clientaccesspolicy.xml file
Here we will be discussing this by using a proxy..
so lets start..
public partial class MainPage : UserControl
private Uri RSSUrl;
private XmlReader reader;
// Required to initialize variables
RSSUrl = new Uri("http://al.cloudapp.net/proxy.ashx?http://www.sun.com/rss/news-rss.xml");
private void LoadXMLFile()
WebClient xmlClient = new WebClient();
xmlClient.DownloadStringCompleted +=new System.Net.DownloadStringCompletedEventHandler(xmlClient_DownloadStringCompleted);
private void xmlClient_DownloadStringCompleted(object sender, System.Net.DownloadStringCompletedEventArgs e)
string xmlString = e.Result;
XDocument xd = XDocument.Parse(xmlString);
var v = from g in xd.Descendants("item")
select new Feeds
Title = g.Element("title").Value,
WebClient Class->Provides common methods for
sending data to and receiving data from a resource identified by a
URI.I have used Linq(Language Integrated Query)to read the xml file.
I have not put try catch block ,i leave that upto you guys.and one
more thing now you can bind the result "v" to the Listbox of
silverlight to see the result.
For more information, you can contact me at : http://www.dexterity.co.in