3

I'm downloaded the code from John Papa's book here: http://silverlight-data.com/

and am sucessfully running the Chapter 7 example which allows you to press

a button and it reads RSS from digg.com and then displays it.

So, then I replaced the digg URL

http://services.digg.com/stories/topic/microsoft/?appkey=http%3A%2F%2Fwww.silverlight-data.com&count=20]

with my RSS feed:

http://tanguay.info/web/rss

but I get this error on the DownloadStringCompleted event:

Result 'e.Result' threw an exception of type 'System.Reflection.TargetInvocationException' Error = {System.Security.SecurityException ---> System.Security.SecurityException: Security Error bei System.Net.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) bei System.Net.BrowserHttpWebRequest.<>c__DisplayClass5.

I tried other RSS feeds, e.g.: http://news.google.com/nwshp?hl=en&tab=wn&output=rss

and I get the same security error.

What can I do to avoid getting these errors so that I can consume these feeds from Silverlight?

Aaron Fischer
  • 20,853
  • 18
  • 75
  • 116
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047

2 Answers2

4

If you try to access a website/url that differs from the url your silverlight application is run under you will need to set up a cross site policy file or access a site that has one allowing access.

[edit added Tim Heuer's links]

Aaron Fischer
  • 20,853
  • 18
  • 75
  • 116
  • hmm, I don't see how that protects the silverlight application: if a hacker snuck code to execute into the application so he could get data from across the internet, of course he would also make a policy file on his server so his virus could access the data it needs, what am I missing? – Edward Tanguay Jan 30 '09 at 15:52
  • I would think it would be the other way around: I create a silverlight application and define which sites IT is allowed to access so that if it does ever execute malicious code then that code cannot go download other data from other sites. – Edward Tanguay Jan 30 '09 at 15:53
  • It's not designed to protect your application. Its designed to protect the content hosts website. Silverlight behaves pretty much the same as flash in this regard. In other words it prevents another website trying to impersonate the content website. – Aaron Fischer Jan 30 '09 at 16:28