Are you using multiple CD Servers architecture (Sitecore
Web Farm)? Have you checked the machine key across the CD servers?

Are you using any below functionality in your solution?
  • forms authentication tickets,
  • MVCs anti-forgery tokens,
  • and other services which use machine key
  • any encryption/decryption using machine key

All the above
functionality is machine key dependent.

And if your machine key
is not sync across the multiple CD servers, then you might face some below problem.
  • Sometimes login failed
    (during password encryption/decryption)
  • Server Error in ‘/’
    Validation of 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

These error still coming
after enabled the affinity in the load balancer

Load balancer- sticky session
) helps to ensure that any
given client only interacts with one physical server behind the load balancer
so that all cryptographic payloads will be both generated by and consumed by
the same server.

But sometimes most load
balancers will redirect the client to a different physical server if the
original server to which the load balancers were affinitized goes offline. This causes the new server to
reject cryptographic payloads. That the client currently has.

We faced the same issue “Validation of viewstate MAC failed error” in log file. 
and also faced some cryptography error because  we used some machine key depended algorithms in the project.

NOTE: we used sticky session in load balancer, but one of our server went down
frequently and we 
didn’t set the machine key in the web config. 
so this is the root cause of all problems 

Solution: Sync the machine key across the CD servers:

Generate <machineKey>
for separate web config application:
By using IIS
  • Open your IIS
    Manager from Administrative tool -> Internet
    Information Services Manager.
  • In Connection pane
    on left side of window, click on the website.

Place these key in webconfig for each CD server

<?xml version=”1.0″






Sitecore Always Recommended to keep the same machine key in web config across the multiple CD servers environment 

I hope this article will help you!!

Happy Sitecore 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *