By default, ASP.Net 2.0 encrypts the data in the ViewState with a private key generated on the server. This key is unique to the server. So in a scenario where there is more than one server e.g. in a web farm, each server will generate its own key. This is where the trouble starts.
Consider there are 3 servers A, B and C. Say users first request is served by server A. Now when user posts the data back, say the request is sent to server B. Server B will now try to validate the data in ViewState with its own key. As the key is different to the one with which the data was encrypted, it will fail validation and will raise "Unable to validate data" error. To avoid this, configures MachineKey element in Web.Config for a cohosted website or in Machine.Config for dedicated server. Please see http://msdn2.microsoft.com/en-us/library/ms998288.aspx on how to configure machinekey.
DebugGuru
Consider there are 3 servers A, B and C. Say users first request is served by server A. Now when user posts the data back, say the request is sent to server B. Server B will now try to validate the data in ViewState with its own key. As the key is different to the one with which the data was encrypted, it will fail validation and will raise "Unable to validate data" error. To avoid this, configures MachineKey element in Web.Config for a cohosted website or in Machine.Config for dedicated server. Please see http://msdn2.microsoft.com/en-us/library/ms998288.aspx on how to configure machinekey.
DebugGuru
Comments
what about maintaining state?