Sebastian Suchanowski Programmer's notes

20Apr/130

Invalid length for a Base-64 char array

Lately I am working on iDoc24 stuff (www.iDoc24.com and www.stdtriage.com) and this is my major responsibility for the moment – but not only iOS apps but also taking care of backend system (which was originally written in asp.net – bleh! :p). I’ve encountered a lot of issues there and I’d like to share them with you.

Here is the most important line from stack trace I’ve got

1
at System.Convert.FromBase64String(String s)

Apparently there is some issue regarding space sign – urlDecode replaces all ‘+’ chars with ‘ ‘ which cause the error. Quick and simple solution presented bellow will make your string base 64 compatible again.

1
Convert.FromBase64String(encodedStr.Replace(" ", "+"))
Share!

This post is also available in: Polish

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.