Fixed – 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 exception in Plugin (Dataverse / Dynamics 365)


Recently, while working on a plugin that moves attachments to Azure Blob Storage, the author encountered an exception related to a non-valid Base-64 string. The exception occurred when trying to decode a Base64 encoded string into its original byte array using the FromBase64ToString method. The author discovered that there were issues with the uploaded image, as even when trying to download it from the browser, they received the same exception. The solution was to check if the string is a valid Base64 encoded string before converting it to a byte array. If it is not valid, the author skipped processing that attachment and moved on to the next one.


Article 14m

Login now to access my digest by 365.Training

Learn how my digest works
Features
  • Articles, blogs, podcasts, training, and videos
  • Quick read TL;DRs for each item
  • Advanced filtering to prioritize what you care about
  • Quick views to isolate what you are looking for right now
  • Save your favorite items
  • Share your favorites
  • Snooze items you want to revisit when you have more time