crossdomain.xml和clientaccesspolicy.xml有什么区别?

[已解决] crossdomain.xml和clientaccesspolicy.xml有什么区别?

10
[Web开发 > Silverlight]
SL中crossdomain.xml和clientaccesspolicy.xml有什么区别? 必须两个都存在还是可以任意选择一个?
提问时间:2010/8/8 14:50:49 | 提问者:GaLiJiKuai | 悬赏:10 | 浏览:850
最佳答案
SilverLight要实现跨域访问,必须在服务端被访问域的直接域名下,配置 clientaccesspolicy.xml( 或 crossdomain.xml)文件,即可以访问 http://{domainName}/clientaccesspolicy.xml。


具体来说,如果后台服务部署在IIS中,默认是放在“inetpub/wwwroot”目录下;如果后台服务是部署在Tomcat中,默认是放在“tomcat\webapps\ROOT”目录下。

Flash 和 Silverlight 的 crossdomain.xml 是通用的,Flash 的跨域请求应该也是一样的原理

这两个文件并不都需要放在域根下,但我更喜欢用clientaccesspolicy,因为他可以用来设置Socket.

它们的区别说明在B2的文档中

Silverlight supports two types of security policy files:

•Flash policy file - the existing crossdomain.xml policy file used by Adobe Flash. This policy file can only be used by the WebClient and HTTP classes in the System.Net namespace. A Flash policy file must allow access to all domains to be used by the Silverlight 2 runtime.

•Silverlight policy file - the Silverlight policy file that can be used by the WebClient and HTTP classes in the System.Net namespace and also by the sockets classes in the System.Net.Sockets namespace. This policy file has a different format than the Flash policy file.

All in all, Silverlight policy can be used by all kinds of Connection between Client and Server.

Refer to your question, if you only put one of them onto the root, cross-domain-access is also allowed, but for crossdomain.xml CrossDomain for Sockets doesn't allow.
回答时间:2010/8/8 14:52:30 | 回答者:56max
其他参考答案(0)
提交失败!请检查错误!错误信息:

注:以上所有信息由网友提供,仅供交流、参考,均不代表盛派网络言论,如果有任何问题或不妥,请立即联系我们