Error Distance Matrix API

  • Thread starter Thread starter MAGOS LEANDRO
  • Start date Start date
M

MAGOS LEANDRO

Guest
I'm using the google maps API to get the distance between two addresses.

Dim url As String = "https://maps.googleapis.com/maps/ap...a&key=AIzaSyCu28EUSx4LAHgF-fEYbUYBGzlqUyl_43o"

Dim request As WebRequest = WebRequest.Create(url)


Using response As WebResponse = CType(request.GetResponse(), HttpWebResponse)

Using reader As StreamReader = New StreamReader(response.GetResponseStream(), Encoding.UTF8)

Dim dsResult As DataSet = New DataSet()
dsResult.ReadXml(reader)

Label1.Text = dsResult.Tables("distance").Rows(0)("text").ToString
End Using
End Using

I need to exit through the proxy and set it up in web.config.

<system.net>
<defaultProxy>
<proxy proxyaddress="http://proxypac.internet.ccf/FilePACrest.pac" bypassonlocal="True"/>
</defaultProxy>
</system.net>


When I access it through the internet explorer (using the proxy settings) I can access the normal address, but when I access the application, I get error 400 (Bad Request - Invalid URL). I added a Label and put it to display the address, I can access it through IE, but as I said, the application gives an error.

When I remove the Proxy address from the web.config and access on localhost it works, however on the server I need to exit through the proxy.

Continue reading...
 
Back
Top