Question

I am currently using this map API http://msdn.microsoft.com/en-GB/library/ff701724.aspx (Rest Imaging API) to generate a static map route with 3 push points in it. (Basically a image) I require for a ASP.net MVC 5 project.

ATM it is working fine (By using simply a img tag and the src as the link) however I am not sure I am using it right (Spent 6 hours so far trying different things) WOO -_-

Example String: "http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/Routes?wp.0=" + Add1 + ";50;F" + "&wp.1=" + Add2 + ";23;LD" + "&wp.2=" + Add3 + ";53;T" + "&ms=500,500&key=theKey"

Example: <"img src="http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/Routes?wp.0=london;50;F&wp.1=paris;23;LD&wp.2=ny;53;T&ms=500,500&key=theKey">

It works well no issues at all... However when you right click it the image obviously shows the URL search string as above (No real issue) but also the API key in the string....

I cant for the life of me think how to either get the map image (But hiding the key) or get the map and recreate the image using ASP.net MVC 5 so the whole query is not there. Or even just hide the image link... (Sounds more simple than it is...)

Either way, anything I am trying is not working (And my brain is just frazzled trying to think of a solution)

Am I simply overthinking this (AKA is what I have ATM ok as the API page seems to think it is?) or am I missing something very obvious?

Either way any advice would be greatly appreciated :D

Was it helpful?

Solution

Having the API in the URL is fine as anyone can create a free Bing Maps account and there is no need to steal someone else's. That said, if you want to hide it in this case you could instead get the 64bit encoded data for the image and pass that to the src property of the image tag instead. You could do this on either client or server side of things. If done on the server side then end users won't be able to sniff the network traffic to see the key in the URL. All this said, it's not something I would worry about. The only cases of misuse of Bing Maps keys such their introduction several years ago has mainly been due to people handing off code samples that included a Bing Maps key and someone else using the code in production unaware of the key in the code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top