Jan 08, 2018 03:10 AM|Brando ZWZ|LINK
Getting errorInvalid length for a Base-64 char array or string.
According to your codes, I have created a test demo on my side, it works well.
The result like this:
Besides, the "Getting errorInvalid length for a Base-64 char array or string." error often occurred when you using the wrong base64 string.
The length of a base64 encoded string is always a multiple of 4. If it is not a multiple of 4, then = characters are appended until it is.
If the base64 string is not right, you should add the "=" to the last, like this code:
// a is stringint mod4 = a.Length % 4;
if ( mod4 > 0 )
a += new string( '=', 4 - mod4 );