The viewstate is invalid for this page and might be corrupted.

M

Mike

hi to all
does any body know or receive this message before
and how i can repare this:

The viewstate is invalid for this page and might be corrupted.
thank's
Mike
 
S

Scott M.

This generally happens if you try to transfer to a different page. The
viewstate is transferred to the new page and does not match up against the
controls on the new page. Are you trying to transfer control to a different
page?
 
A

Adrijan Josic

I did plenty of server.transfers to different pages. It
doesn't force the posted viewstate onto the transferred
page AFAIK. You can access the original page properties
and viewstate from the target page using the
Context.Handler and typecasting the original page class on
it to get its values/viewstate if you somehow know what
the original page class is(you can pass some kind of
parameter in the querystring when doing server.transfer
for this purpose)

in class Search: Page
....
Server.Transfer("Results.aspx?fromPage=Search");
....

in class Results: Page

if(Request.QueryString["fromPage"]=="Search")
{
Page pageThatTransferredToMe = (Search)Context.Handler;
//now you can get to the originally loaded page properties
}

Anyway, I usually get that error when I add/remove server
controls in an aspx/ascx file while having the page open
in the browser. If you do this and try to submit the page,
click something, you will get this error because the
version page you're submitting had a different set of
server controls thus a different viewstate than the
version of the page that's trying to load the submit
viewstate. You only have to reload the page(enter it again
in the adress bar) instead of submiting it...

You could be getting this error for some other reasons
though... a bit of code or something might be helpful...
Perhaps you corrupted the viewstate hidden input or the
form with javascript or modified the LoadViewState process
somehow... who knows...
 

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

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top