Skip to main content

Microsoft Silverlight

Answered Question Using WebClient to fetch tiles from VirtualEarth results in System.Security.SecurityExceptionRSS Feed

(0)

alecb
alecb

Member

Member

0 points

6 Posts

Using WebClient to fetch tiles from VirtualEarth results in System.Security.SecurityException

I'm trying to use WebClient to download virtual earth Map Tiles from http://r1.ortho.tiles.virtualearth.net/tiles. I've used the tile scheme previously in a Windows Form Application without issues. However, in my port to SilverLight, all my Web Client map tile downloads fail with System.Security.SecurityException.

When I created my SilverLight project in Visual Studio, I opted for the 'Automaticall generate a test page to host SilverLight at build time'. When I run the test page in the debugger my Web Client downloads fail.

I am guessing that this is something to do with cross domain security policies. Howvever, since I chose the 'test page' option rather than the ASP.Net option, I don't know where to start in setting up a policy file  to allow acccess to VE tiles from my SilverLight page. Any help in the content of a policy file and where to put it to allow access would be greatly appreciated.

Thanks. 

 

 

 

ksleung
ksleung

Contributor

Contributor

5396 points

1,028 Posts

Answered Question

Re: Using WebClient to fetch tiles from VirtualEarth results in System.Security.SecurityException

The policy file is located at the root of the host of the URL, i.e. http://r1.ortho.tiles.virtualearth.net/crossdomain.xml.  Therefore, unless you have access to that, you cannot set up the security policy.  Only recourse is to use a proxy server (under your control) such that you make a request to the proxy server (with the right security permission setup by you) which in turn fetch the content and pass it back to you.

alecb
alecb

Member

Member

0 points

6 Posts

Re: Using WebClient to fetch tiles from VirtualEarth results in System.Security.SecurityException

Thanks for the response ksleung, however, there must be a better approach than this. The virtual earth tile server is accessible to general web clients so there must be a way to make it accessible to a SilverLight page without a proxy that effectively requires a double transfer of each tile.

If I create a local http file that host a Virtual Earth Map Control then I don't need to set up a proxy or any policy files to see the map tiles. It just works. There must be a way to achieve the same result from within SilverLight without a proxy.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities