View Full Version : Handling illogical routes

12-14-2010, 11:22 AM
I need help handling the situation that occurs when I request an illogical route. Let me explain:

I've written an asp.net app in vs2008. My mapping page includes the following script tag:
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx? v=6.3"></script>

A client has given me an excel file that becomes my source data of cities, states and postal codes. (I know I hate this but I'm stuck with it!) My immediate task is to build a list of route mileage between all locations. I've setup an array for the locations, and have written a pair of javascript functions that recursively walks thru the array, makes a GetDirections call on each location pair, handles the callback (and recalls itself). All works as intended but occasionally I get this popup:

unable to find a route for the locations you entered.

It's not surprising that I have some junk to work with from the excel source and I've cleaned it as much as I can. I may never be able to perfectly validate the data. I need to trap this situation so that I can debug and handle it.

I don't know whether this is even an error, or whether Bing even makes a callback in this situation. I've tried try/catch blocks, and testing for null, all to no avail.

Can anyone help me on this?