Error accessing RSS feed from Silverlight with WebClient()

天涯浪子 提交于 2019-12-07 19:44:15

问题


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?

|improve this question

回答1:


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.

  • Silverlight Cross Domain Policy File Checker
  • Silverlight cross domain policy file helpers

[edit added Tim Heuer's links]

  • HOW TO USE CROSS DOMAIN POLICY FILES WITH SILVERLIGHT
  • WORKING WITH SYNDICATED DATA



回答2:


Also please see http://silverlight.net/learn/learnvideo.aspx?video=65672 and http://silverlight.net/learn/learnvideo.aspx?video=47174



来源:https://stackoverflow.com/questions/495868/error-accessing-rss-feed-from-silverlight-with-webclient

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!