title: Getting '(400) Bad Request' with GetResponseStream() in C#
body: <p>I am using the following code to send a get request to facebook graph api oauth server.  </p>
  
  <pre><code>public string GetAccessToken(string code)
      {
          HttpWebRequest req = (HttpWebRequest) WebRequest.Create(@"https://graph.facebook.com/oauth/access_token?client_id=249725835046216&amp;redirect_uri=http://localhost:2794/&amp;client_secret=APP_SECRETa&amp;code=" + code);
          HttpWebResponse res = (HttpWebResponse)req.GetResponse();
          string response=res.GetResponseStream().ToString();
          return response;
      }
  </code></pre>
  
  <p>The above code throws the following exception:</p>
  
  <pre><code>The remote server returned an error: (400) Bad Request.
  </code></pre>
  
  <p>Meanwhile if I type the same url in browser, it works. Please help, where am I wrong?</p>
  
  <p>(P.S In the URL, I am surely replacing APP_SECRET with the secret key)</p>