Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight clientaccesspolicy.xml bug? or design?

In the domain node of a clientaccesspolicy file you can specify a wildcard for a sub domain or protocol, but it would appear not for a port.

Specifically when developing, if the service consumed is hosted on a third party, then access from a local debug version of a silverlight app running on the localhost asp.net development server works fine with the nodes:

<domain uri="*"/>
<domain uri="http://*"/>
<domain uri="http://localhost:1234"/> 

(where 1234 is the specific determined port number)

but it would appear not to work if specified in the form

<domain uri="http://localhost:*"/>

which is extremely annoying if there are multiple developers/projects using the service or you do not specify a port for the asp.net development server

Does annyone know if I am simply getting the format incorrect or is this either a bug or an oversight in the handling of the clientaccesspolicy by silverlight?

like image 705
UKShots Avatar asked Mar 04 '10 14:03

UKShots


People also ask

How does client access policy work in Silverlight?

The way this is done is using an XML file with the name "clientaccesspolicy.xml" or "crossdomain.xml". when our Silverlight application communicates with the server that served the application, the communication here is allowed because this is on the same domain from where your app was served.

Where do I place a crossdomain XML file in Silverlight?

• Place a valid crossdomain.xml file at the root of the domain where the service is hosted. Silverlight supports a subset of the crossdomain.xml schema. This file format is supported as well by ADOBE FLASH (originally by them).

How to grant access to multiple domains in Silverlight?

If we want to grant multiple domains access, an admin simply can modify the clientaccesspolicy.xml file. crossdomain.xml" was created originally for use with Flash applications. For communication between specific Silverlight application and server,these both files do not need to present.

What is cross domain policy in Silverlight?

A cross-domain policy file specifies the permissions that a web client such as Java, Adobe Flash, Adobe Reader, etc. use to access data across different domains. A client access policy file is similar to cross-domain policy but is used for Silverlight applications.


2 Answers

The behavior you describe is in line with the documentation, which states:

There are three types of wildcards allowed:

A standalone '*' wildcard. This option is used to allow access to all domains of the same scheme. An HTTP service will allow all HTTP callers. An HTTPS service will allow all HTTPS callers.

An "http://*" literal wildcard. This option explicitly allows all HTTP callers, even if this is an HTTPS service.

A subdomain wildcard. This option uses a wildcard at the first segment of the path ("http://.contoso.com", for example) that allows all subdomains of the domain specified. So for the example. http://web.contoso.com and http://mail.contoso.com would be allowed. Note that a uri path where the wildcard does not occur as a prefix (http://web..com, for example) is disallowed.

http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx

So there's nothing about wildcards for ports, which (you're right) does not make any sense when you allow wildcards for hosts and domains.

like image 133
GreenIcicle Avatar answered Nov 15 '22 09:11

GreenIcicle


Work-around:

Under Properties of your website hosting the SL app, go to the Web tab, and change the Auto-assign Port to Specific Port. This way, you can set your localhost:1234 port in the clientaccesspolicy file as you already illustrated, and expect it not to need a port change no matter what developers also then use the project.

This is not a perfect solution, as its always nicer to auto assign rather than hard set ports in projects. Buts its a good option to try.

like image 20
dapug Avatar answered Nov 15 '22 10:11

dapug