Click here to Skip to main content
15,900,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
I am creating windows application using c# 2010, in my application I am upload a image to database using image data type. Once stored is success (it’s working good) after that again I am bind a image, that time below error is came in first line

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters.

  byte[] imageBytes = Convert.FromBase64String(base64String);
 MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);

How to solve this error, any one give me ideas.


What I have tried:

Restore Image binding error in c# windows application
Posted
Comments
F-ES Sitecore 16-Dec-16 5:26am    
The error is self-explanatory, the data you have in base64String is not a base64 string, it has invalid characters. We don't know what is in that string or where it comes from. You'll need to find out what characters are invalid then trace things back to try and work out where those invalid characters came from.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900