Monday, March 28, 2011

Viewstates in C#

So, as is inevitable with any .NET admin.. (pseudo admin in my case)... I ran headfirst into a fight with the viewstates...

Between the various view state errors... I looked online and found this


 What does the EnableViewStateMac setting in an aspx page do?
Setting EnableViewStateMac=true is a security measure that allows ASP.NET to ensure that the viewstate for a page has not been tampered with. If on Postback, the ASP.NET framework detects that there has been a change in the value of viewstate that was sent to the browser, it raises an error - Validation of viewstate MAC failed.
Use <%@ Page EnableViewStateMac="true"%> to set it to true (the default value, if this attribute is not specified is also true) in an aspx page.

I also highly recommend reading this article


It is very precise explanation of the devil that is viewstate

No comments: