简体   繁体   中英

Silverlight cross domain calls

I am new to Silverlight and especially in URL Access Restrictions in Silverlight 5. I am trying to use the bellow code to get to any domain, which Apparently I can't due to missing crossdomain.xml and clientaccesspolicy.xml on those websites.

HtmlWeb.LoadAsync("http://www.otherwebsite.com", OnCallback); 

if (htmlDocumentLoadCompleted.Error != null)
{
  var htmlDocument = htmlDocumentLoadCompleted.Document;
  if (htmlDocument !=null)
   {
    MessageBox.Show("Passed!");
   }
}

Hence, I have the nasty error :

{System.Security.SecurityException ---> System.Security.SecurityException: Security error.
   at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)

I've tried several options, in and out browser with and without Elevated Trust. So, my question is it possible at all to get it working In or Out the browser?

Service should share cross domain policy. For example amazon crossdomain . This is the only possible way to use the service.

UPD: From MSDN :

Silverlight trusted application is run within an expanded sandbox which allows it to access network and local resources that a normal Silverlight application is explicitly denied the ability to access for security reasons.

So, i think you should give your application elevated trust and run it (application) out-of-browser or in-browser (if only under administrator privileges).

Also: URL Access Restrictions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM