0

我是 Silverlight 的新手,尤其是 Silverlight 5 中的 URL 访问限制。我正在尝试使用下面的代码来访问任何域,显然我不能,因为这些网站上缺少 crossdomain.xml 和 clientaccesspolicy.xml。

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

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

因此,我有一个讨厌的错误:

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

我已经尝试了几个选项,在有和没有提升信任的情况下进出浏览器。所以,我的问题是有可能让它在浏览器中工作还是在浏览器中工作?

4

1 回答 1

1

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

于 2013-08-16T16:04:49.347 回答