Solution of asp.net Silverlight cross-domain problem

Source: Internet
Author: User
SilverLight for security reasons, access to the URL is strictly restricted by default, allowing access only to URL resources under the same child domain.
The following table lists the URL access rules in Silverlight 2.0:
  WebClient object Media, images, ASX XAML file, Font file streaming media
allowed protocol HTTP, http S http, https, file http, https, file http
Cross-protocol access do not allow do not allow do not allow do not allow access from HTTPS
cross-web domain access does not allow if not from HTTPS allow do not allow allow
Cross-Secure zone access (Windows) does not allow do not allow not allowed do not allow
Cross-Secure zone access (Macintosh) does not allow allow do not allow allow
allow redirection same domain allow allow same-domain allow do not allow

If WCF is not on the same site as the Silverlight Web, then we will put two XML file clientaccesspolicy.xml,crossdomain.xml on the root domain of the access side .
Clientaccesspolicy . xml is best saved in utf-8 format, and the contents of the file are as follows:
The content of ClientAccessPolicy.xml
   
    
<?xml version= "1.0" encoding= "Utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from>
<domain uri= "*"/>
</allow-from>
<grant-to>
<resource path= "/" include-subpaths= "true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
The crossdomain.xml format is very simple, and its root node is <cross-domain-policy>, which contains one or more <allow-access-from> nodes,< Allow-access-from> has a property domain, which is the value of a field that is allowed to be accessed, an exact IP address, an exact domain, or a wildcard value field (any domain).
Crossdomain.xml Demo
   
    
<?xml version= "1.0"?>
<cross-domain-policy>
<allow-access-from domain= "http://www.lishewen.com.cn/"/>
<allow-access-from domain= "*.lishewen.com.cn"/>
<allow-access-from domain= "222.217.221.16"/>
</cross-domain-policy>
For more information on these two files, see MSDN http://msdn.microsoft.com/en-us/library/cc645032 (vs.95). asp Tutorials x

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.