title: "Validation of viewstate MAC failed" with Kentico 7.0 and IIS 7.5
body: <p><strong>The Situation:</strong></p>
  
  <p>We have 2 Webserver IIS7.5 which run loadbalanced (Software, standard install) framework 4.5 installed</p>
  
  <p>We have a Kentico 7.0 Installation running on both Server.</p>
  
  <p><strong>The Problem:</strong></p>
  
  <p>The Site load normal, but when i change to the CMSDesk and try to login(with IE8), i get the Error Message(very fast not, even a second): </p>
  
  <pre><code>Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that &lt;machineKey&gt; configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 
  </code></pre>
  
  <p>Eventlog</p>
  
  <pre><code>Event code: 4009 
  Event message: Viewstate verification failed. Reason: The viewstate supplied failed integrity check. 
  </code></pre>
  
  <p>with Chrome 27+ it takes about 3-4 Seconds but the CMSDesk appears (only sometimes the error appears, i can't say when ?!). That's why i can exclude a IE8 Problem</p>
  
  <p><em>Now it gets really spooky, <strong>even if i take on Server out of the Loadbalancer!</em></strong></p>
  
  <p><strong>What i have tried:</strong> <em>(All this experiments i tried in various combinations)</em></p>
  
  <p>0) googled like crazy, recycled the apppool and clear the cache. BASICS</p>
  
  <p>1) Set the machinekey element in the </p>
  
  <pre><code>machine.config's (rebooted the servers afterwards)
  %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\config\machine.config
  %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\config\machine.config
  %SystemRoot%\Microsoft.NET\Framework64\v2.0.50727\config\machine.config
  %SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\config\machine.config
  
  Example Code (in all Files the SAME KEYS)
  &lt;system.web&gt;
    &lt;machineKey validationKey="EEF33150A048D162D22CB36E1CB9956B148C7A4E6999D0F05B53D416D7A16F83823DD626F501DD3549D3E5DCB473634739D0AD9A07F71560946498C943A7586D"
      decryptionKey="0E95F75864047EB6322EA7D5246F2C1175D77A1B016F293C3BAAD000299A3DC8"
      validation="SHA1"
      decryption="AES" /&gt;
  &lt;/system.web&gt;
  </code></pre>
  
  <p><em>Result: same Error</em></p>
  
  <p>2) i even set it in the webconfig (just to be sure). </p>
  
  <p><em>Result: same Error</em></p>
  
  <p>3) i set the attribute enableViewStateMac on the pages-element in the Web.config to false (just to see if it works, i am not a fan of security holes)</p>
  
  <p><em>Result: no Error, but i stayed on the Login page. and on the kentico-event-log  there was a successful auth message. hmm?! So, i turned it back to true, to be SAFE;-)</em>
     The other Securityhole solutions like auth never and so on i didn't even try, since it should be a save page.</p>
  
  <p>4) i checked if the page really loaded completly (since in some Forum's it was stated, that if the page is not completly load it could break the viewstate and the validation wouldnt work)</p>
  
  <p><em>Result: same Error</em></p>
  
  <p>5) i tried the "Unsafe" Kentico Workaround, Setting a Attribute in the web.config / settings section</p>
  
  <pre><code>    &lt;add key="CMSUseViewStateUserKey" value="false"/&gt;
  </code></pre>
  
  <p><em>Result: Same as by Number 3</em></p>
  
  <p>6) i even looked into the "lookahead downloader bug in IE8", but this should be fixed with KB980182 and i have installed (Yes i am grabbing for straws now)</p>
  
  <p><em>JUST LOOKED</em></p>
  
  <p>7) the ViewState doesnt seem too long, due to the fact that it is only a login form</p>
  
  <p><em>JUST LOOKED</em></p>
  
  <p>8) Called the one Server directly without the cluster IP-Adress</p>
  
  <p><em>Result: It Works. (YEY)</em> </p>
  
  <p>-> All this information is somewhat confusing for me and how do i get the Cluster to work?</p>
  
  <p>*) Chrome works 90 - 99% with the Cluster / with on Server in the Cluster / on Server directly</p>
  
  <p>*) IE 8 doesn't works with the Cluster</p>
  
  <p>*) IE 8 doesn't works with the Cluster with only one server</p>
  
  <p>*) IE 8 works directly on the Server</p>
  
  <p><strong>Conlusion so far:</strong></p>
  
  <p>*) It could be an IE8 Bug </p>
  
  <p>*) It could be something with the loadbalancing, Cluster or the Domainname (i think).</p>
  
  <p>*) I must discard the Chrome/ Error due to the fact that at present i cant reproduce anymore</p>
  
  <p>*) due to Point 3 It Must be something With the MAC feature (<a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;829743" rel="nofollow">http://support.microsoft.com/</a>)</p>
  
  <p>I would be thankful for any input / pointer /...</p>
  
  <p>P.s.: please don't be hard on me this is my first question.</p>