I am trying to make a facebook open graph api call from inside by web application.I am making a web request using a C# request like this.
string token = "q2Fe0utty5gzCasPL23...";
string url = "https://graph.facebook.com/me?access_token=" +
HttpUtility.UrlEncode(token) +"&response_type=id";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = newStreamReader(receiveStream,Encoding.UTF8);
string responseData = readStream.ReadToEnd();
_context.SaveChanges();
As the token has some special characters(+,/,==) in it i have encoded it using HttpUtility.UrlEncode(token) but still i get the following error.
The remote server returned an error: (400) Bad Request.
How do i go about fixing this error. I did the above things by seeing some response in stack-overflow, but still getting the error.Where did i go wrong?