I have a valid base64 string that I can decode it in online tools but when it comes to line below;
string token = "eyJ1bmlxdWVfbmFtZSI6InllbmVyLnlpbG1hekB5ZHlhemlsaW0uY29tIiwiZ2l2ZW5fbmFtZSI6Ik1laG1ldCBZZW5lciIsImZhbWlseV9uYW1lIjoiWUlMTUFaIiwiZW1haWwiOiJ5ZW5lci55aWxtYXpAeWR5YXppbGltLmNvbSIsInJvbGUiOiJBZG1pbiIsIm5iZiI6MTU4NTI0OTI1NCwiZXhwIjoxNTg1ODU0MDU0LCJpYXQiOjE1ODUyNDkyNTR9==";
try
{
var asd = Convert.FromBase64String(token);
}
catch (Exception ex)
{
throw;
}
It throws exception..
Exception Message:
"The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters."
Why does this happen?