One user of a website that I support receives the following error whenever performing a particular web based task:
System.Web.HttpException: Validation of viewstate MAC failed
This error only ever occurs for a single user browsing from an IE7 Browser.
I have crossed off the following usual suspects:
- The web-server is not a part of a web farm
- I have added code to ensure that the ViewState from being rendered at the beginning of the form to prevent the problem where the user performs a second post the Validate ViewState tag is rendered.
This form contains a drop-down box where the contents are modified client side via JavaScript. Could this cause the error for a particular user?
Is it possible that the there is something malicious running on the client side for that PC that is playing with the ViewState?
This problem was caused by the ViewState being validated incorrectly due to its size. The problem was resolved by implementing the “ViewState Chunking” technique to break the ViewState into many smaller pieces thereby allowing validation to be completed correctly.
This technique is described here.