title: 403 forbidden. WebException was unhandled .NET
body: <p>I have coded a class to calculate the distance between two coordinates. But as soon as I run the project, it gives an error:</p>
  
  <blockquote>
    <p>WebException was unhandled.</p>
    
    <p>An unhandled exception of type 'System.Net.WebException' occurred in System.Xml.dll</p>
    
    <p>Additional information: The remote server returned an error: (403) Forbidden.</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>public Tuple&lt;double, double&gt; GetCoords(string Streetnumber, string Streetname, string Cityname, string Country)
  {
      XmlDocument doc = new XmlDocument();
      string clientId = "///"; =
      string key = "//";
      string address = Streetnumber + "+" + Streetname + ",+" + Cityname + ",+" + Country;
  
      var urlRequest = "/maps/api/geocode/xml?address=" + address + "&amp;client=" + clientId;
      System.Security.Cryptography.HMACSHA1 myhmacsha1 = new System.Security.Cryptography.HMACSHA1();
      myhmacsha1.Key = Convert.FromBase64String(key);
      var hash = myhmacsha1.ComputeHash(System.Text.Encoding.ASCII.GetBytes(urlRequest));
      string signature = Convert.ToBase64String(hash).Replace("+", "-").Replace("/", "_");
      WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials;
  
      doc.Load("https://maps.googleapis.com/maps/api/geocode/xml?address=" + address + "&amp;client=" + clientId + "&amp;signature=" + signature);
  
      string longitude = doc.SelectSingleNode("//GeocodeResponse/result/geometry/location/lng").InnerText;
      double lng = LongitudePlace(longitude);
      string latitude = doc.SelectSingleNode("//GeocodeResponse/result/geometry/location/lat").InnerText;
      double lat = LatitudePlace(latitude);
      return Tuple.Create(lng, lat);
  }
  </code></pre>
  
  <p>I also have some other methods but they are irrelevant to this problem. The error is given at: </p>
  
  <pre><code>doc.Load("https://maps.googleapis.com/maps/api/geocode/xml?address=" + address + "&amp;client=" + clientId + "&amp;signature=" + signature);
  </code></pre>
  
  <p>Maybe this is easy to fix, but I tried a lot of things. My <code>clientID</code> is correct, also the key which is the secret key at console.developer.google.com if I'm not mistaking.</p>
  
  <p>I tried a test address of "1600", "Amphitheatre+Parkway", "Mountain+View", "CA".</p>
  
  <p>How to solve the error?</p>