Facebook crossdomain.xml silverlight 错误
我的 Facebook 照片服务器上的 crossdomain.xml 有问题。当 Silverlight 请求 clientaccesspolicy.xml 时,第一个问题出现了 – Facebook 服务器返回 403 – 访问被拒绝,这很好,因为他们的服务器上也部署了 crossdomain.xml。然后,Silverlight 请求 crossdomain.xml,它得到的响应正是这样:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain- policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" secure="false" to-ports="*" />
<site-control permitted-cross-domain-policies="master-only" />
</cross-domain-policy>
然后我用这个玩了一段时间,将该 crossdomain.xml 部署到我自己的服务器上,得到了相同的结果 - 一个安全异常。然后我开始将东西移出并得出结论:如果我只删除 to-ports="*" 属性,一切都会按预期工作?有谁知道如何克服这个问题,以前有人遇到过同样的问题还是我做错了什么?
I have a problem with crossdomain.xml that is located on Facebook photo servers. The first problem arises when Silverlight asks for clientaccesspolicy.xml – Facebook servers return 403 – Access Denied which is fine, since they also have crossdomain.xml deployed on their servers. Silverlight then asks for that crossdomain.xml and the response it gets is exactly this:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain- policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" secure="false" to-ports="*" />
<site-control permitted-cross-domain-policies="master-only" />
</cross-domain-policy>
Then I played for a while with this, deployed that crossdomain.xml to my own servers and a got the same results – a security exception. Then I started moving things out and came to a conclusion that everything will work as desired if I only remove the to-ports="*" attribute? Does anyone has an idea how to overcome this, has anyone had the same problem before or is it something that I’m doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在尝试以编程方式从 Facebook 检索图像时遇到了同样的问题。奇怪的是,如果您将 Silverlight 图像控件指向 Facebook 图像 url,则图像将被检索并显示,不会出现错误。这让我开始思考,我想出了一个可行的解决方法,它似乎始终适合我的情况。我希望你也觉得它很有用。
创建
BitmapImage
对象,为ImageOpened
事件设置事件处理程序,并将CreateOptions
属性设置为BitmapCreateOptions.None
。最后,将UriSource
设置为您要检索的 Facebook 图像。由于我们将CreateOptions
设置为None
(默认值为DelayedCreation
),因此图像会立即下载。然后,您可以在ImageOpened
事件处理程序中执行您想要的任何操作。我想将此逻辑封装在我的服务层中,并加强错误处理等,因此我将其包装在 Reactive Extensions observable 中,以使其更易于使用。这是我的最终代码片段:
和用法:
我希望有人发现这很有用。
I have run into the same issue while trying to programmatically retrieve images from Facebook. The strange part is that if you point a Silverlight image control to the Facebook image url, the image is retrieved and displayed without error. This got me thinking and I have come up with a viable workaround that seems to work consistently for my situation. I hope you find it useful too.
Create a
BitmapImage
object, set an event handler for theImageOpened
event and set theCreateOptions
property toBitmapCreateOptions.None
. Finally, set theUriSource
to the Facebook image you want to retrieve. The image is downloaded immediately because we set theCreateOptions
toNone
(the default value isDelayedCreation
). You can then perform any actions you would like in theImageOpened
event handler.I wanted to encapsulate this logic in my service layer and beef up the error handling and such so I wrapped it in a Reactive Extensions observable to make it easier to use. Here is my final code snippet:
And usage:
I hope someone out there finds this useful.
这个问题在 Silverlight 5 中仍然没有得到解决。Facebook 似乎也不担心。
This is still not resolved in Silverlight 5. Facebook doesn't seem concerned too.