?
Solved

Invalid length for a Base-64 char array

Posted on 2006-06-30
5
Medium Priority
?
637 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 750 total points
ID: 17043741
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

764 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