Solved

Invalid length for a Base-64 char array

Posted on 2006-06-30
5
582 Views
Last Modified: 2008-01-09
Hello,

I'm getting the following error back from a central error handling routine in the global.asax:

Exception Message: Invalid length for a Base-64 char array.
Exception Source: mscorlib
Exception StackTrace:    at System.Convert.FromBase64String(String s)
   at System.Web.UI.LosFormatter.Deserialize(String input)
   at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
Exception TargetSite: Byte[] FromBase64String(System.String)

I've seen other postings for this exception, but none have been helpful. It seems to be related to viewstate, but in this case, the stack trace doesn't event tell me the source page, so I don't know where to begin troubleshooting this.
0
Comment
Question by:LloydMc
  • 3
  • 2
5 Comments
 
LVL 23

Expert Comment

by:apresto
ID: 17018751
how are you creating the base64string that is being passed in?
0
 

Author Comment

by:LloydMc
ID: 17043395
apresto,

The base64 string is created by an query string encryption(DES) routine. Some further research revealed that the DES encryption method places "+" characters in the encrypted data and these get parsed as empty strings when the string is decrypted. I changed the decryption method to replace any empty strings with "+", but we're still getting the errors.

What's so maddening is the stack trace isn't telling me what page or process the error occured in.
0
 
LVL 23

Expert Comment

by:apresto
ID: 17043422
if you base64string has + or " ", get rid of them, If you havent done already you can use .Replace to do this:

MyBase64String.Replace("+", "").Replace(" ", "")

0
 

Author Comment

by:LloydMc
ID: 17043665
apresto,

I am replacing any empty spaces in the decrypted string with "+" chars, but we're still seeing the error, although we can't reproduce it.
0
 
LVL 23

Accepted Solution

by:
apresto earned 250 total points
ID: 17043741
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now