WebClient.DownloadStringAsync throwing Security Exception in Silverlight

纵饮孤独 提交于 2019-12-04 15:08:41

The crossdomain.xml file needs to be placed on the server you're trying to download the file from, not on the server that serves the Silverlight application.

If the server doesn't have a crossdomain.xml file, the Silverlight runtime does not allow your application to download data from that server. By default, it can only access the server it was downloaded from (same origin policy).

Digg.com doesn't have a crossdomain file (meaning that Silverlight and Flash clients cannot directly use the API). Direct access from Silverlight is not possible.

One work around would be to make a proxy on your web host. The proxy will call Digg's API's from your web server rather than directly from the Silverlight client.

Silverlight ==> YourWebHost ==> Digg.com

Another workaround would be to use their JavaScript API instead, and then use the JavaScript bridge to communicate to JavaScript from Silverlight.

Silverlight ==> JavaScript ==> Digg.Com ==> JavaScript ==> Silverlight

For a JavaScript call: http://developers.digg.com/response

Silverlight bridge reference: http://msdn.microsoft.com/en-us/library/cc645076(VS.95).aspx Walkthroughs: Silverlight to JavaScript: http://msdn.microsoft.com/en-us/library/cc221359(v=VS.95).aspx JavaScript to Silverlight: http://msdn.microsoft.com/en-us/library/cc221414(v=VS.95).aspx

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