Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Using WebClient to fetch tiles from VirtualEarth results in System.Security.SecurityException
2 replies. Latest Post by alecb on June 29, 2009.
(0)
alecb
Member
0 points
6 Posts
06-29-2009 4:31 PM |
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
Contributor
5396 points
1,028 Posts
06-29-2009 4:36 PM |
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.
06-29-2009 5:07 PM |
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.