日期:2014-05-17  浏览次数:20432 次

google地图API服务器
google地图API服务器拒绝了您的请求。请求中指定的‘sensor'参数必须设置为‘true'或'fase'
这是什么情况,我该怎么解决 .在本地调试行,但是运行在服务器上就提示上面那个。

------解决方案--------------------
用V3版吧,不需要密钥

参考地址

C# code
 
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script>

  <script type="text/javascript">
    var directionDisplay;
    var directionsService = new google.maps.DirectionsService();
    var map;
    var geocoder;

    function initialize() {
      directionsDisplay = new google.maps.DirectionsRenderer();
      geocoder = new google.maps.Geocoder();

      var chicago = new google.maps.LatLng(41.850033, -87.6500523);
      var myOptions = {
        zoom: 7,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        disableDefaultUI: true,
        center: chicago
      }
      map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
      directionsDisplay.setMap(map);
      directionsDisplay.setPanel(document.getElementById("directionsPanel"));


      var tmpArr, QueryString;
      var URL = document.location.toString();
      if (URL.lastIndexOf("?") != -1) {
        QueryString = URL.substring(URL.lastIndexOf("?") + 1, URL.length);
        QueryString = QueryString.substring(QueryString.lastIndexOf("=") + 1, QueryString.length);
        tmpArr = QueryString.split("&");
        for (i = 0; i < tmpArr.length; i++) {
          try {
            var ID = eval(tmpArr[i]);
          }
          catch (e) {
            var re = new RegExp("(.*)=(.*)", "ig");
            re.exec(tmpArr[i]);
            try { eval(RegExp.$1 + "=" + "\"" + RegExp.$2 + "\""); }
            catch (e) { }
          }
        }
      }
      else {
        QueryString = "";
      }
      if (QueryString.length > 0) {
        document.getElementById("addressIfnfo").value = QueryString;
        $(document).ready(function() {
          codeAddress();
        });
      }
    }

    function calcRoute() {
      var start = document.getElementById("fromAddress").value;
      var end = document.getElementById("toAddress").value;
      var request = {
        origin: start,
        destination: end,
        travelMode: google.maps.DirectionsTravelMode.DRIVING
      };
      directionsService.route(request, function(response, status) {