gruber
gruber

Reputation: 29729

Firefox problem: the state information is invalid for this page and might be corrupted

Ive noticed that on my pages which uses updatePanel I get an error after ctrl+r or hitting F5. When I then try to do asynchronous postback there is the message:

the state information is invalid for this page and might be corrupted

I ve read that Response.Cache.SetNoStore(); but on my instance of ff 3 it doesnt really work.

Is there any other solution ? I user ASP.Net 2.0

thanks for any help

Upvotes: 1

Views: 2936

Answers (2)

robert
robert

Reputation: 1533

this can happen when you load some content/ controls with ajax into a containing div (assuming the div is within the form element of the body).. remember when you're using webforms they all got the <body><form id="ctrlsomething">stuff</form></body> format ... when you do a postback, form gets submitted and the content controls/elements do not match original ones (remember you added stuff)... hence the error.

one way to overcome this is by adding element via javascript/jquery at the start

$('body').append("<div id='myframe_that_ajax_will_fill_with_stuff'></div>");

this adds <div id='myframe_that_ajax_will_fill_with_stuff'></div> within the body, after </form> so you'ld be fine

other options is disabling eventvalidation/viewstate on page level, but this can lead to security holes

Upvotes: 0

MUS
MUS

Reputation: 1450

This problem occurs specifically when you postback before the EventValidation field has been rendered. If EventValidation is enabled (by default), but ASP.NET not able to see the hidden field when you postback, you also get the exception. If you submit a form before it has been entirely rendered, then chances are the EventValidation field has not yet been rendered, and thus ASP.net cannot validate your click.

One work around is of course to just disable event validation, but you have to be aware of the security issues.

In general it is not advisable to disable EventValidation. To quote MS documentation

"It is strongly recommended that you do not disable event validation. Before disabling event validation, you should be sure that no postback could be constructed that would have an unintended effect on your application.".

http://msdn2.microsoft.com/en-us/library/system.web.ui.page.enableeventvalidation.aspx

Also have a look at a detailed post that talks about several advantages and disadvantages of disabling Event Validation.

http://odetocode.com/Blogs/scott/archive/2006/03/21/3153.aspx . This link does have some devs talking about the samE kind of error that you are experiencing.

Upvotes: 1

Related Questions