Tuesday, May 15, 2012

Invalid_Viewstate ... System.FormatException: Invalid length for a Base-64 char array.

We've been running an ASP.NET 1.1 application on 4 servers for 2 years and have been getting intermittent Viewstate exceptions reported through our exception publisher emails. These emails contain quite a lot of information about a request where an exception occurs, so I can provide lots of data about this problem.

First, you should know that I have searched far and wide for the solution to this problem and am convinced that the only solution is to disable Viewstatw MAC checking on all of our servers to make this go away. Naturally, I don't want to do this for security reasons.

Second, we have synchronized the <machineKey> elements on all four servers so we are using a 128-byte encryption key and a 48-byte decryption key and SHA1 hashing.All servers in the group have the exact same settings for <machineKey> and they are not overridden anywhere.

The symptom is this: one of our users navigates into our sales application and stops at some point in the process (gets up for a cup of coffee or whatever, or goes home for the night). When they resume the ordering process, they receive this error:

EDR.IDG.IDGWEBException: Invalid_Viewstate

System.FormatException: Invalid length for a Base-64 char array.
  at System.Convert.FromBase64String(String s)
  at System.Web.UI.LosFormatter.Deserialize(String input)
  at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
  --- End of inner exception stack trace ---
  at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
  at System.Web.UI.Page.LoadPageViewState()
  at System.Web.UI.Page.ProcessRequestMain()
  --- End of inner exception stack trace ---

I can reproduce this error and it does not occur under normal circumstances when people proceed through the application and close the browser, as far as I know.

Is there a time/date element to the encryption/decryption scheme that would render the Viewstate invalid after some period of time elapses? Does anyone have the solution to this problem?

Thanks.





If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website