Solved

Invalid length for a Base-64 char array

Posted on 2006-06-30
5
631 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 250 total points
ID: 17043741
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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 we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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