“Invalid length for a Base-64" asp mvc 4 error message”

Hi. Last week I encountered this type of error message while trying to do a simple validation user’s registration form on asp.net mvc. It happen when I’m trying to click the “Submit” button and whoosh! this error pop-out.


I thought it must be something to do with byte[] data type since, one of my required field are stored as byte[]. So, of course la, my ultimate references would be uncle google! most of the result page shows that the errors caused by trying to convert byte[] to string vice versa, or its usually happen when you are trying to upload/ display image data from the database.

Nearly half a day, I ‘m trying to fix this error but none of the suggestion works. hurm.

I’d tried to inspect my page, looking at those scripts, nothing suspicious, then I looked into my model view page, controller page, domain page, I clueless!, I’d tried to put some breakpoints in my controller page, but it seems the error happens before the breakpoint events…

I give up after 4 hours non-stop looking at the same error.

I went to solat. yeah. trying to kusyuk but ….. argh..

Took a sip of coffee, looking at the yellow empty decorated wall, suddenly, my eyes saw a solution!

Quickly I ran into my laptop, looking back at my “view” page, navigate into my byte[] field, then taDAAAA!!!!!!

Silly me! arghhhh, tension aku..


Ha, can you guess what is the error?

Of course la, you are binding the model with byte[] datatype, before the conversion function take place in the controller page. Clumsy mistake huh.


It should be set as above. (ignore spelling error on password thou)


So, please please please, open your eyes WIDELY before you started to goggling and end up sank like me. Smile



Leave a Reply

Your email address will not be published. Required fields are marked *

This function has been disabled for my360days .

Pin It on Pinterest