Silverlight cross-scheme access to jpegs denied
I've got a Silverlight4 app that I'm running on https, deployed to Azure. Everything's working except for one small glitch. I've got content in the form of jpg thumbnails and associated zip files with a .gld extension. My app is supposed to display the thumbnails, and allow the users to download the associated .gld/zip files.
The downloads works fine, but, the thumbnails won't display in my UI. I get AG_E_NETWORK_ERROR from my ImageFailed handler. I do have a clientaccesspolicy.xml file in the root of my cdn domain. Fiddler does not show Silverlight accessing this file.
Here's the clientaccesspolicy.xml:
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from>
<domain uri="*"/>
<domain uri="http://*"/
<domain uri="https://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true" /&g开发者_开发百科t;
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
I'm stumped as to how Silverlight can access the downloadable content, but not the image files. The app does pick up the thumbnails if I deploy them to blob storage in azure (with the same clientaccesspolicy.xml file in the $root folder), but it would be ideal if I can continue the same file structure that already exists on my cdn provider.
Everything displays perfectly if the Silverlight app runs in http rather than https.
Thanks in advance for any ideas!
Michael Conner
thanks for all the suggestions - have tried them all -- still no luck, sadly. ImageFailed event for bitmap doesn't give much detail, unfortunately. I think we maybe be up against the cross-scheme restriction on image files.
You are missing a ">" in line 7.
Check the uri used in fiddler or the like, check images are using https
try to implement more debug output - maybe like this:
You can trap the error. BitmapImage, Image, ImageBrush, MultiScaleImage all have an ImageFailed event. Just set an event handler to it.
or try this:
<allow-from http-request-headers="*">
I know it's a very old question but if someone is still stuck in a similar situation Silverlight does not allow cross scheme access. You will have to have either http on both ends or https. From MSDN : URL Access Restrictions in Silverlight
If you want to host your Silverlight application and store your images on different servers, the restrictions are as follows: You cannot store your images on a site that uses the HTTPS scheme if you are hosting your application on an HTTP site (cross-scheme).
You can store your images on a cross-domain site as long as the
scheme of that cross-domain site is the same as the scheme of the
site hosting your application.Silverlight applications running on Windows cannot store images on a server in the Local Intranet zone if the application was downloaded
from the Internet zone (cross-zone), except if the target domain is
localhost.You can redirect to another image URL as long as the URL uses the
same scheme.
精彩评论