By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,638 Members | 1,983 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,638 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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?

"Mike" <bl****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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

Nov 18 '05 #2

P: n/a
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...
-----Original Message-----
This generally happens if you try to transfer to a different page. Theviewstate is transferred to the new page and does not match up against thecontrols on the new page. Are you trying to transfer control to a differentpage?

"Mike" <bl****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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

.

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.