Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3211272
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:42:58+00:00 2026-05-17T14:42:58+00:00

it is September 2010 and I am trying to update Facebook connect integration on

  • 0

it is September 2010 and I am trying to update Facebook connect integration on our website.

I need to validate auth cookie that was set by Facebook code. I was following PHP sample from http://developers.facebook.com/docs/guides/web

please check the C# code:

    public static Dictionary<string, string> ParseCookie(HttpCookie fbCookie)
    {
        if (fbCookie == null)
            return null;

        string value = fbCookie.Value.Substring(1, fbCookie.Value.Length - 2);
        SortedDictionary<string, string> sargs = new SortedDictionary<string, string>();

        foreach (string pair in value.Split('&'))
        {
            string[] keyvalue = pair.Split('=');
            sargs.Add(keyvalue[0], keyvalue[1]);
        }

        string sid = sargs["sig"] ?? string.Empty;
        sargs.Remove("sig");

        string payload = string.Empty;
        foreach (KeyValuePair<string, string> pair in sargs)
        {
            payload += pair.Key + "=" + pair.Value;
        }

        if (string.IsNullOrEmpty(payload) || DataFormatter.GetMD5Hash(payload + Settings.ApplicationSecret).ToUpper() != sid.ToUpper())
            return null;

        return sargs.ToDictionary(pair => pair.Key, pair => pair.Value);
    }

DataFormatter.GetMD5Hash method is:

    public static string GetMD5Hash(string key)
    {
        StringBuilder result = new StringBuilder();
        MD5 md5 = new MD5CryptoServiceProvider();
        foreach (byte b in md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key)))
            result.Append(b.ToString("X2"));

        return result.ToString();
    }

The problem is that my md5 never matches sig from Facebook.

    DataFormatter.GetMD5Hash(payload + Settings.ApplicationSecret).ToUpper() != sid.ToUpper()

is always True

Please help to find the solution.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T14:42:58+00:00Added an answer on May 17, 2026 at 2:42 pm
        public static Dictionary<string, string> ParseCookie(HttpCookie fbCookie)
        {
            if (fbCookie == null)
                return null;
    
            string value = fbCookie.Value.Substring(1, fbCookie.Value.Length - 2);
            SortedDictionary<string, string> sargs = new SortedDictionary<string, string>();
    
            foreach (string pair in value.Split('&'))
            {
                string[] keyvalue = pair.Split('=');
                if (keyvalue.Length != 2)
                    continue;
                sargs.Add(keyvalue[0], keyvalue[1]);
            }
    
            string sid = sargs["sig"] ?? string.Empty;
            sargs.Remove("sig");
    
            string payload = sargs.Aggregate(string.Empty, (current, pair) => current + (pair.Key + "=" + HttpUtility.UrlDecode(pair.Value)));
    
    
            if (string.IsNullOrEmpty(payload) || DataFormatter.GetMD5Hash(payload + Settings.ApplicationSecret).ToUpper() != sid.ToUpper())
                return null;
    
            return sargs.ToDictionary(pair => pair.Key, pair => pair.Value);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want a cron expression that represents 6th September 2010 6:00 am
I have an application that is good from September 1st of the current year,
I've noticed that Lucene recently released v2.9 (on 25th September this year - 2009),
I am trying to write some code that will function like google calendars quick
Need your help, trying to change this script: https://github.com/MrHus/jquery-monthly-ical To load external JSON data
In epoch 1265997351408 is Fri Feb 12 2010 12:55:51 GMT-0500 (EST) I am trying
on their website they have announcements made at various times saying that it is
I am using Excel 2010. I have a monthly data table that looks similar
I'm trying to write application that periodically receives e-mails. It writes every mail into
i want to show jquery calendar dates from 1st september 2010 to current date.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.