The View State Is Invalid for This Page and Might Be Corrupted

B

Brad

I have an intranet app that has just started sporadically getting the
following error
"The viewstate is invalid for this page and might be corrupted."
By sproadic I mean 3-4 times during the past two days out of 100's of hits.
The error just started yesterday and this app has been running for quite
some time without this error and has not been updated just before or after
the error started.

Reseaching this error I've checked the following:

I found the following KB article however it references framework 1.0 and
I'm using 1.1 (and VS 2003)
http://support.microsoft.com/default.aspx?scid=kb;EN-US;323744
I am not setting enableViewStateMac in the web config so it is
defaulting to True from the default machine config setting

Here is more detail from a stack when the error occurs

########## System.Web.HttpUnhandledException ##########
Exception of type System.Web.HttpUnhandledException was thrown.
Stack
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionSte
p.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
########## System.Web.HttpException ##########
The viewstate is invalid for this page and might be corrupted.
Stack
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadPageViewState()
at System.Web.UI.Page.ProcessRequestMain()
=========================================================


Brad
 
S

Steven Cheng[MSFT]

Hi Brad,


Thanks for posting in the community!
From your description, you encountered "Viewstate is invalid for this page"
error in your ASP.NET web app. And this occurs occassionally recently, yes?
If there is anything I misunderstood, please feel free to let me know.

As you mentioned this problem only occured recently, has the application or
certain page's code been modified? Generally the "Viewstate is invalid for
this page" error occurs because the ASP.NET found the viewstate info
invalid when loading them from client request.
Here is a kb article on a hotfix for troubleshooting this.
#INFO: "Viewstate is invalid for this page" error message does not provide
sufficient information to troubleshoot the issue
http://support.microsoft.com/default.aspx?kbid=831150

Also, does this problem occurs on a particular page or in more than one
pages? Would you like to have a check on the following items to see whether
the page suffering the problem has such feature?
1.The form is posted to anther web page

2.The page added dynamic controls at runtime
----------------------------description in MSDN---------------------
However, view state information about dynamically created controls can be a
problem in two scenarios:

If you insert dynamic controls between existing controls.
If you insert controls dynamically and then reinsert them during a round
trip, but with different values.
If you insert dynamic controls between existing controls, the dynamic
control's view state information is inserted into the corresponding
location of the view state structure. When the page is posted and the view
state is loaded, the dynamic control does not yet exist; therefore, the
extra information in view state does not correspond to the right control.
The result is usually an error indicating an invalid cast.
----------------------------------------------------------------------------
-----

3. The page's source is potentially modified sometimes at runtime, this is
also mentioned in the below kb article.
#FIX: "The View State Is Invalid for This Page and Might Be Corrupted"
Error Message in ASP.NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;323744

Please check out the above suggestions. If you have any quesitons or have
any new findings, please feel free to post here.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Joined
Sep 25, 2007
Messages
2
Reaction score
0
I didn't see any hotfix to download. The link provide by you takes me to Microsoft site with contact info.
 
Joined
Aug 4, 2008
Messages
1
Reaction score
0
I had this error when I was using AJAX to load a page into the page into the page that was using the viewstate for a post back. If you are doing this make sure that you don't fetch the viewstate from the ajax page as the server will confuse them.
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top