title: Google Map Direction Api Works Fine Locally but does not work properly when deployed on Server
body: <p>I am trying to get direction details between a source and destination by calling Google Map API XML in a web service using c#. When I try to call below function locally, it works fine. But when I deploy my code on the server, for some locations, it does not give direction details. The local System where I try is Win2K8 R2 and the web server is Win2K3. Here is my Code</p>
  
  <pre><code> public List&lt;DirectionSteps&gt; getDistance(string sourceLat, string sourceLong, string destLat, string destLong)
      {
      var requestUrl = String.Format("http://maps.google.com/maps/api/directions/xml?origin=" + sourceLat + "," + sourceLong + "&amp;destination=" + destLat + "," + destLong + "&amp;sensor=false&amp;units=metric");
      try
      {
          var client = new WebClient();
          var result = client.DownloadString(requestUrl);
          //return ParseDirectionResults(result);
          var directionStepsList = new List&lt;DirectionSteps&gt;();
          var xmlDoc = new System.Xml.XmlDocument { InnerXml = result };
          if (xmlDoc.HasChildNodes)
          {
              var directionsResponseNode = xmlDoc.SelectSingleNode("DirectionsResponse");
              if (directionsResponseNode != null)
              {
                  var statusNode = directionsResponseNode.SelectSingleNode("status");
                  if (statusNode != null &amp;&amp; statusNode.InnerText.Equals("OK"))
                  {
                      var legs = directionsResponseNode.SelectNodes("route/leg");
  
                      foreach (System.Xml.XmlNode leg in legs)
                      {
                          //int stepCount = 1;
                          var stepNodes = leg.SelectNodes("step");
                          var steps = new List&lt;DirectionStep&gt;();
  
                          foreach (System.Xml.XmlNode stepNode in stepNodes)
                          {
                              var directionStep = new DirectionStep();
                              directionStep.Index = stepCount++;
                              directionStep.Distance = stepNode.SelectSingleNode("distance/text").InnerText;
                              directionStep.Duration = stepNode.SelectSingleNode("duration/text").InnerText;
  
                              directionStep.Description = Regex.Replace(stepNode.SelectSingleNode("html_instructions").InnerText, "&lt;[^&lt;]+?&gt;", "");
                              steps.Add(directionStep);
                          }
  
                          var directionSteps = new DirectionSteps();
                          //directionSteps.OriginAddress = leg.SelectSingleNode("start_address").InnerText;
                          //directionSteps.DestinationAddress = leg.SelectSingleNode("end_address").InnerText;
                          directionSteps.TotalDistance = leg.SelectSingleNode("distance/text").InnerText;
                          directionSteps.TotalDuration = leg.SelectSingleNode("duration/text").InnerText;
                          directionSteps.Steps = steps;
                          directionStepsList.Add(directionSteps);
                      }
                  }
              }
          }
          return directionStepsList;
      }
      catch (Exception ex)
      {
          throw ex; 
      }
  
      }
  </code></pre>