Tips, tricks, and frustrations from my years of building ASP.NET websites.

Showing posts with label Web Farm. Show all posts
Showing posts with label Web Farm. Show all posts

Wednesday, April 9, 2008

Invalid Viewstate errors when hosting on a Web Farm

Everybody has seen the dreaded 'Invalid Viewstate' error from time to time. There are many reasons this can occur. If you host your site on multiple hosts behind a content switch on a web farm you will immediately receive these errors in bulk.

There is an easy solution to this problem:

1. Generate 2 unique HEX keys using this program.

2. Change the \Windows\Microsoft.NET\Framework\<.NET version>\CONFIG\machine.config file on each host in your web farm and add this entry (use your generated keys):


<system.web>

<machineKey validationKey="thekey" decryptionKey="thekey" validation="SHA1"/>

</system.web>

About Me

I'm currently employed as a Senior Systems Programmer/Analyst and sometimes Project Manager at Texas Instruments Inc. in Plano TX.