1

I've spent about two days looking into this issue and can't seem to find a resolution, or the ones provided don't seem to fully address the issue I am having.

  • I have an ASP.NET Application, .NET 4.0
  • Intermittently, we will get errors about View State corruption
  • This only seems to apply to Mozilla based browsers (not 100% sure, trying to get more error logs to confirm)
  • It seems to start with no consistent re-produceable action.
  • It is NOT related to MAC getting out of sync, we have our machine key / validation key explicitly set and not set to auto-generate
  • It is only happening in our Production environment, has never happened in DEV/QAT/UAT
  • It is happening on pages that have an Update Panel - while some of the pages do have a very large view-state, a few of them have a very small view-state
  • Does not seem to be re-producable. Some solutions I have found have been in relation to 'Click on a page, click on a button that goes to another page, click back in the browser and the error happens' - this is not that case.
  • IIS7 on Windows Enterprise 2008, 16GB ram, PAE is enabled.
  • The pages will work fine for awhile, and then stop working - restarting IIS solves this issue temporarily.
  • This is not running on a Web Farm The exception/stack trace:

Description:

Error occurred System.Web.HttpException (0x80004005): The state information is invalid for this page and might be corrupted. ---> System.Web.UI.ViewStateException: Invalid viewstate.

Client IP: <removed>

Port: 21884

Referer: <removed>

Path: /PathToPage/Page.aspx

User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; MS-RTC LM 8)

ViewState: /wEPDwULLTEyNTU4MDc4NT....<removed by user>... ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

at System.Convert.FromBase64String(String s)

at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)

at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState)

at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)

at System.Web.UI.HiddenFieldPageStatePersister.Load()

--- End of inner exception stack trace ---

at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)

at System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState)

at System.Web.UI.HiddenFieldPageStatePersister.Load()

at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()

at System.Web.UI.Page.LoadAllState()

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
TinMan
  • 11
  • 3

1 Answers1

0

Because this issue happens only on update panel page, I suspect that you get error after the update panel that break the viewstate, and you simple did not catch and you can not see this errors.

To locate them a temporary solution is to remove the update panel to see if you get any errors.

Second solution is to compress and cut the view state in smaller part in case some proxy or router in the middle breaks its.

Some more to read: ASP.Net Post timeout and CryptographicException: Padding is invalid and cannot be removed and Validation of viewstate MAC failed

Community
  • 1
  • 1
Aristos
  • 66,005
  • 16
  • 114
  • 150
  • The last time this error started, I got a copy of the code from the production branch, pointed it to the production database and ran it locally (Same code-base, same Database). Went to the screen/entity that was causing the error for the user, repeated the action and everything worked fine. Logged into the production website, repeated the action in FireFox - it crashed. Things will also work fine for a period of time (used to be month+ between it happened, now it's happened a few times in a period of a few days. No application of environment changes). – TinMan Jul 05 '11 at 23:54
  • @TimMan also this sounds like a gzip fail. If you set content-length on your page in some part, just remove it, and test again. This content-length can be false if the gzip is happens again after the page have been send, and this cause firefox to crash. It crash because the content length is wronge of the page, and the gzip gives error, and firefox crash. – Aristos Jul 06 '11 at 00:00