Monday, January 23, 2017

Sitecore WFFM viewstate validation error

A fresh install of web forms for marketers had been deployed to a scaled 7.5 instance of Sitecore. The following error message was reported by a user:
Validation of the viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same ValidationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
Looking into the web.config files the machineKey element was completely missing. The Sitecore scaling guide had the following to say:
In a single instance environment, you shouldn’t change the configuration.

If the environment contains two or more instances:

In the web.config file, set the validationKey and the decryptionKey attributes of the /configuration/system.web/machineKey element to a non-auto generated value. Ensure that the values are identical for all the instances within the environment and that the IsolateApps modifier is not present in either value.
Therefore a machine key generator can be used to generate a valid machine key. An example would be:
<machineKey validationKey='7652D32FB7D858DC44FA409A88FDB9AC8E9811C4F2F4174F138A7901F53CF8E759551BA8EBCD923B5FFEE87737BDA8DA18337BDE51E7C89934B4B1D4F3C84F01' decryptionKey='8158C85A02EADC24CDD400E2E71D2D77B6B3A14E4EABD041'   validation='SHA1'/>
Take note that IsolateApps is not present after either of the keys and that a key is set rather than AutoGenerate.

No comments:

Post a Comment