| Subject: |
AJAX: UpdatePanel invalid ViewState with Firefox |
| Updated: |
Dec-30-2007 |
| Rating: |
Not Rated |
| By: |
Rocky Moore - Member #: 1 |
| Location: |
Klamath Falls, Oregon USA |
| Website: |
www.RockyMoore.com |
| Category: |
Computers > Programming > .NET > ASP.NET |
When using an Ajax UpdatePanel, everything seemed to work fine on different flavors of IE, but when used on Firefox and I would hit the Refresh button, my postbacks seemed to stop working. I checked into the javascript error that was coming up which said
"The state information is invalid for this page and might be corrupted"
After a bit of research, I found a post (do not recall where), that mentioned this is an issue with the way Firefox caches viewstate. There was several suggestions ho to handle this, but most would be a security risk.
Finally, I spotted one that mentioned he added a:
Response.Cache.SetNoStrore()
on the the page load and it worked for him. Another followup post said they included filtering out so that this is only set on Firefox:
if (Request.Browser.Browser == "Firefox") Response.Cache.SetNoStore();
For me, using Visual Studio 2008 Pro with IIS7, and IE7, this still did not work.
I found another post that mentioned using:
Response.AppendHeader("Cache-Control", "no-cache; private; no-store; must-revalidate; max-stale=0; post-check=0; pre-check=0; max-age=0");
I put that into my "Page_Load" with a check for Firefox (like above) and presto, the error vanished!
So, if one method does not work for you, give the other a try.
[Submit DIGG for this tip]
-----------
Note: Use the tips posted on this site at your own risk.
The tips are posted by the public and as such may or may not be valid.