I have problem decode this base64 string, it always return ' Invalid length for a Base-64 char array or string'. But I managed to decode online at 'https://www.base64decode.org/'
These are my codes:
string base64Encoded = "eyJ4NXQjUzI1NiI6IndVWUdZWXp5dTJPMzNtVjY1WHFBVzBiTFlMeU5TU2VKZFlGTldKNnpzY0kiLCJ4NXQiOiJ0V3lmNTA0aTM3TXZxN0t1eEVyQTY4VTE4c1kiLCJraWQiOiJTSUdOSU5HX0tFWSIsImFsZyI6IlJTMjU2In0";
string base64Decoded;
byte[] data = Convert.FromBase64String(base64Encoded);
base64Decoded = Encoding.UTF8.GetString(data);
base64Encodedstring value is not valid. It's missing the trailing'='padding characters. You can add them back by appending the correct number of=characters./and+thatConvert.FromBase64String. Some variants don't require the=padding characters at the end, which is what makes me think that this could be a variant.