Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 16028

VS 2017 Error Distance Matrix API

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

Code:


Dim url As String = "https://maps.googleapis.com/maps/api/distancematrix/xml?origins=RuaBrasil&destinations=RuaItapeva&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

Code:

<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.

Viewing all articles
Browse latest Browse all 16028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>