title: REST API in c# facebook
body: <p>I am trying to use REST API to get friends lists from fb.</p>
  
  <p>ArrayObject is filled with: </p>
  
  <ul>
  <li>SecretKey</li>
  <li>API_KEY Method = "facebook.friends.get" </li>
  <li>call_id uid </li>
  <li>v = 1.0 </li>
  <li>sig = md5 code</li>
  </ul>
  
  <p>And I'm trying to make the call with:</p>
  
  <pre><code>public string GetResponse(ArrayObject Parameters)
  {
      // Set the encoding type
      theRequest.ContentType = "application/x-www-form-urlencoded";
  
      theRequest.ContentLength = Parameters.getData().Length;
  
      // We write the parameters into the request
      StreamWriter sw = new StreamWriter(theRequest.GetRequestStream());
      sw.Write(Parameters.getData());
      sw.Flush();
      sw.Close();
  
      // Execute the query
      theResponse = (HttpWebResponse)theRequest.GetResponse();
      StreamReader sr = new StreamReader(theResponse.GetResponseStream());
      return sr.ReadToEnd();
  }
  </code></pre>
  
  <p>But I get an exception here:</p>
  
  <pre><code>theResponse = (HttpWebResponse) theRequest.GetResponse();
  </code></pre>
  
  <p>with a Message of:</p>
  
  <blockquote>
    <p>The remote server returned an error:
    (500) Internal Server Error.</p>
  </blockquote>