I have an ASP.net 3.5 sp1 web application that is running on IIS6 and has the machine and validation keys set in the web config. The application functions correctly on all browsers except safari.
The page loads correctly but when a postback is performed I receive a “Validation of Viewstate MAC failed” error. (Also, the app pool only recycles once a day during the night but this shouldn’t make a difference as the keys are fixed.)
I have found several suggestions on the internet including limiting the size of the viewstate fields via the web config and also disabling Prefetch within safari – non of which have worked.
I have found other posts on Stackoverflow but non of them helped in resolving the issue.
Is this a known issue with safari or has anyone else encountered this problem ?
We had a similar problem start on Mar 12, 2012 which is the day tha Safari 5.1.4 was released. The problem occurs in Safari 5.1.5 as well. It happens on both windows and mac versions of safari.
In our case the viewstate being submit by Safari was a complete viewstate, unfortunately it was for the previous page rather than the page being posted.
To verify this
So if you find they are different, you are probably experiencing the problem we were experiencing.
In our case the offending code that caused the problem was actually on the previous page. In PageOne we hooked in window.onload event and were calling form[0].submit. The server responded with a 302 redirect to PageTwo.aspx. The browser properly responded by performing a GET of Page2.aspx. When the user pressed the submit button on PageTwo.aspx the validation error occurs, in our case safari was submitting the value of the viewstate for the previous page, pageone.aspx
In our case we worked around the problem by calling setTimeout(“DoWork()”,10); in the window.onload event. Then put our code in the DoWork() function.
We have submitted a bug report to Apple.
Hope this helps.