title: oAuth/Gmail from ASP.NET - "The remote server returned an error: (400) Bad Request"
body: <p>I have been banging my head on this for a long time now no avail. 
  Hoping some fellow SOers can help out.</p>
  
  <ol>
  <li><p>using oAuth.net library for the Gmail Contacts API</p></li>
  <li><p>The request seems well-formed and I have stepped through the requests, and cannot discern anything wrong.</p></li>
  <li><p>Tried checking if the timestamp is an issue - it seems that was a common issue on the gmail forums, tried changing to various time-zones, still no luck.</p>
  
  <p>public string WebResponseGet(HttpWebRequest webRequest)
  {
      StreamReader responseReader = null;
      string responseData = "";</p>
  
  <pre><code>try
  {
      //This is where the exception is thrown
      responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream());
      responseData = responseReader.ReadToEnd();
  }
  catch (WebException ex)
  {
      Console.WriteLine(ex);
      throw;
  }
  finally
  {
      webRequest.GetResponse().GetResponseStream().Close();
      responseReader.Close();
      responseReader = null;
  }
  
  return responseData;
  </code></pre>
  
  <p>}</p></li>
  </ol>