Silverlight的跨站策略和跨站策略文件
如果我們需要在Silverlight中跨站調用Web Service,則可能會遇到這個問題:默認情況下,Silverlight是不允許你這么做的。那么如何來解決該問題呢,請看Tim下面的這篇文章
http://timheuer.com/blog/archive/2008/04/06/silverlight-cross-domain-policy-file-snippet-intellisense.aspx
簡單而言,Silverlight并非不支持跨站調用,而是會首先檢查一個文件clientaccesspolicy.xml 如果該文件找不到,則查找另外一個文件crossdomain.xml ,然后再找不到的話,就報告錯誤了
這個問題可以通過監視工具很簡單地看出來
?
If you are starting to get into integrating web services with Silverlight, you'll notice that you have to have a cross domain policy file in place on the target server, that is to say, the server hosting the service you want to implement.? There are some public web services (Flickr, YouTube, Digg, etc.) that already have these files in place for Flash, but implement in a slightly different way.
When calling a cross-domain service, Silverlight will check for the existence of clientaccesspolicy.xml first.? This is the format defined by Silverlight and provides a pretty flexible way to define who can access what services.? If not found, it will then default to look for crossdomain.xml, which is the file format implemented for Adobe Flash.? It is important to note that this file will also still work for most public web services.
轉載于:https://www.cnblogs.com/chenxizhang/archive/2010/03/12/1683939.html
總結
以上是生活随笔為你收集整理的Silverlight的跨站策略和跨站策略文件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 突然记起我也遇到过一个麻花姐
- 下一篇: C#实现winform软件开机自动启动并