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 5990597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:16:01+00:00 2026-05-22T23:16:01+00:00

I am getting following error when I am trying to use Convert.FromBase64String The input

  • 0

I am getting following error when I am trying to use Convert.FromBase64String

“The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters.”

Dim payloadBytes = Convert.FromBase64String(payloadBase64)

Basically when my facebook registration form (http://developers.facebook.com/docs/plugins/registration/) phone field has a dash in it and encoded string is posted to other page and I am trying to decode it there which creates this error. Basically I am trying to extract data from Facebook Signed Request.

  • 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-22T23:16:01+00:00Added an answer on May 22, 2026 at 11:16 pm

    The issue is that the dash is not a valid character in the Base64String. Here is a quote from MSDN:

    The base-64 digits in ascending order from zero are the uppercase characters “A” to “Z”, the lowercase characters “a” to “z”, the numerals “0” to “9”, and the symbols “+” and “/”. The valueless character, “=”, is used for trailing padding.

    You can either take the dash out (which might not be what you want) or you need to figure out what format the data is truly coming in as since it doesn’t seem like it is Base-64 string data.

    http://msdn.microsoft.com/en-us/library/system.convert.frombase64string.aspx

    The issue is that the Facebook Signed Request is using a modified Base-64 request for URL that changes a few things. Here is a quote on what it does:

    For this reason, a modified Base64 for URL variant exists, where no padding ‘=’ will be used, and the ‘+’ and ‘/’ characters of standard Base64 are respectively replaced by ‘-‘ and ‘_’, so that using URL encoders/decoders are no longer necessary and have no impact on the length of the encoded value, leaving the same encoded form intact for use in relational databases, web forms, and object identifiers in general.

    I believe you could solve your problem by simply replace the dash with a plus and replace the underscore with a backslash and you should be able to then decode it from Base-64.

    Here is the link to the Facebook developers page that indicates that the value you are trying to decode is base64url encoded:

    http://developers.facebook.com/docs/authentication/signed_request/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use moles with NUnit and am getting the following error
I am trying to use the scp command but I'm getting the following error:
Hii, When I am trying to use eyedatagrid, I am getting the following error
I'm getting the following error when trying to run a JSP. I'm using Tomcat
I'm getting the following error when trying to build my app using Team Foundation
I am getting the following error when trying to install Visual Studio 2005 on
Trying to use CIColorMap filter, but getting run-time error [NSImage _feImage]: unrecognized selector sent
I am trying to use delayed_job on heroku and I get the following error:
I'm getting the following error when trying to add files to my mercurial repo.
I am getting the following error trying to connect to a local DB2 instance

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.