Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Invalid length for a Base-64 char array

Posted on 2006-06-30
5
Medium Priority
?
643 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

618 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