What causing this “Invalid length for a Base-64 char array”

前端 未结 12 2026
走了就别回头了
走了就别回头了 2020-11-28 02:56

I have very little to go on here. I can\'t reproduce this locally, but when users get the error I get an automatic email exception notification:



        
12条回答
  •  一整个雨季
    2020-11-28 03:28

    My guess is that something is either encoding or decoding too often - or that you've got text with multiple lines in.

    Base64 strings have to be a multiple of 4 characters in length - every 4 characters represents 3 bytes of input data. Somehow, the view state data being passed back by ASP.NET is corrupted - the length isn't a multiple of 4.

    Do you log the user agent when this occurs? I wonder whether it's a badly-behaved browser somewhere... another possibility is that there's a proxy doing naughty things. Likewise try to log the content length of the request, so you can see whether it only happens for large requests.

提交回复
热议问题