URL resource cross-domain access cross-domain use session information

Source: Internet
Author: User
Tags silverlight

SilverLight, for security reasons, restricts access to URLs by default, allowing access only to URL resources under the same subdomain.

The following table lists the URL access rules in Silverlight 2.0:

Td>http, HTTPS, file if not from HTTPS
  webclient object Media , images, ASX XAML file, Font file streaming media
allowed Protocols HTTP, HTTPS http, https, file http
Cross-protocol access not allowed not allowed not allowed do not allow access from HTTPS
cross-web domain access not allowed allow do not allow allow
Cross Security Zone access (Windows) does not allow do not allow do not allow do not allow
Cross Security 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 at the same site as the Silverlight Web, then we are going to put two XML files on the root domain of the accessed side Clientaccesspolicy.xml,crossdomain.xml
If you want to access resources from another site through webclinet, you need to put the domain Access policy XML file on the visited site, or the event arguments inside the complete event will report an empty object reference. This problem has plagued me for a long time, now finally solved, put up to share with you.

For specific instructions on Clientaccesspolicy.xml,crossdomain.xml, please refer to MSDN http://msdn.microsoft.com/en-us/library/cc645032 (vs.95) . aspx

These days want to use Silverlight to access the Web site XML file, as well as cross-domain use session information, has been prompted security errors, search a lot, and finally solved.

To add a ClientAccessPolicy.xml file at the site root, the code is as follows:

<?xml version="1.0"encoding="Utf-8"?><access-policy> <cross-domain-access> <policy> <allow- fromhttp-request-headers="*"> <domain uri="*"/> </allow- from> <grant-to> <resource include-subpaths="true"Path="/interface"/> </grant-to> </policy> </cross-domain-access></access-policy>

Where/interface is the path to the file that needs to be accessed, and the file needs to be placed in the root directory of the site that will be accessed.

I see a lot of include-subpaths= "false" written on the Internet. I tried, seemingly not, and do not know what the reason.

More resources:

Http://silverlightchina.net/html/tips/2009/0916/184.html

Http://silverlightchina.net/html/tips/2010/0107/563.html

This Microsoft detailed description:

http://msdn.microsoft.com/zh-cn/library/cc645032 (v=vs.95). aspx

URL resource cross-domain access cross-domain use session information

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.