Microsoft 9GD00001 ユーザーズマニュアル

ページ / 449
 
298
 
Microsoft Visual Studio 2010: A Beginner’s Guide
The crossdomain.xml policy was created for Adobe Flash applications and can be used 
with Silverlight applications too. Here’s an example:
<!DOCTYPE cross-domain-policy 
  SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> 
<cross-domain-policy> 
  <allow-access-from domain="*" /> 
  <allow-http-request-headers-from domain="*" headers="*" /> 
</cross-domain-policy>
When designing Silverlight, Microsoft recognized that the crossdomain.xml 
file wasn’t flexible enough and added support for another type of policy called 
clientaccesspolicy.xml. Here’s an example:
<?xml version="1.0" encoding="utf-8"?> 
<access-policy> 
  <cross-domain-access> 
    <policy> 
      <allow-from http-methods="*">" 
        <domain uri="*"/> 
      </allow-from> 
      <grant-to> 
        <resource path="/" include-subpaths="true"/> 
      </grant-to> 
    </policy> 
  </cross-domain-access> 
</access-policy>
This clientaccesspolicy.xml listing allows all domains to access all site content that 
isn’t already secured by other means. You can restrict access by replacing the * in the 
domain uri
 with an allowable domain. Further, you can replace the resource path with a 
path on the site to restrict access to specific folders. Add more policy elements to this file 
to add more domains and paths.
Summary
This chapter explains how to run a Silverlight application. You learned how to use the 
MediaElement control and how to build UIs using the same techniques as in WPF. The 
OOB functionality allows you to run Silverlight from your desktop. A section describes 
deploying the Silverlight application to a Web server.
We’ve discussed a couple Web technologies already: ASP.NET MVC in Chapter 9 and 
Silverlight in this chapter. The next chapter shows you another Web technology: WCF 
Web services.