Facebook error

Hi Guys

I have th below code and i am trying to post to a fan page on facebook but it gives me an error of("invalidate parameters")

Please can you assist?

try
        {
            string app_id = "xxxxxxx";
            string app_secret = "xxxxxxxxxxxxxxxxxxxxx";
            string scope = "publish_stream,manage_pages";

            if (Request["code"] == null)
            {
                Response.Redirect(string.Format("https://graph.facebook.com/oauth/authorize?client_id={0}&redirect_uri={1}&scope={2}", app_id, Request.Url.AbsoluteUri, scope));
            }
            else
            {
                Dictionary<string, string> tokens = new Dictionary<string, string>();

                string url = string.Format("https://graph.facebook.com/oauth/access_token?client_id={0}&redirect_uri={1}&scope={2}&code={3}&client_secret={4}", app_id, Request.Url.AbsoluteUri, scope, Request["code"].ToString(), app_secret);

                HttpWebRequest request = System.Net.WebRequest.Create(url) as HttpWebRequest;

                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    StreamReader reader = new StreamReader(response.GetResponseStream());

                    string vals = reader.ReadToEnd();

                    foreach (string token in vals.Split('&'))
                    {
                        //meh.aspx?token1=steve&token2=jake&...
                        tokens.Add(token.Substring(0, token.IndexOf("=")), token.Substring(token.IndexOf("=") + 1, token.Length - token.IndexOf("=") - 1));
                    }
                }

                string access_token = tokens["access_token"];

                var client = new FacebookClient(access_token);

                var parameters = new Dictionary<string, object>();

                parameters["picture"] = "http://www.yaplex.com/logos/yaplex-logo-with-text-small.png";
                //parameters["link"] = "http://yaplex.com/";
                //parameters["name"] = "[name] Facebook name...";
                //parameters["caption"] = " Facebook caption";
                //parameters["description"] = "[description] Facebook description...";
                parameters["message"] = "[message] Facebook message...";

                client.Post("/me/feed", parameters);

            }
        }
        catch (FacebookOAuthException ex)
        {
            //handle oauth exception
        }
        catch (FacebookApiException ex)
        {
            //handle facebook exception
        }

Open in new window

JCWEBHOSTAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chirag zaptechProject ManagerCommented:
Please let me know what version of FB  API you are using and also version of PHP installed on you server where you are running this code. I think it maybe a version issue. I came across something like this before and it turned out to be the fact that the version of API we used for FB was not compatible with the PHP version we had on the server.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JCWEBHOSTAuthor Commented:
thanks i quit trying to fix it
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Facebook

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.