Windows Server

Validation of viewstate MAC failed On asp.net windows server

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster

some general errors you may face , when you earn dedicated server with windows server and host your website applications on IIS service is

    
     Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that  configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.


    
   

Why i’m seeing Validation of viewstate MAC failed

The ViewState is a mechanism built in to the ASP.NET platform for persisting elements of the user interface and other data across successive requests. The data to be persisted is serialized by the server and transmitted via a hidden form field.

This kind of error caused by aps.net worker process or by server IIS recycling the process.The nature of ASP.NET process is to encrypt the viewstate by using Autogenerated Key when the process spins up ,The problem comes when a client (browser) sends the request with a viewstate encrypted with the key generated by another worker process. Since the key is different, ASP.NET will not be able to decrypt the viewstate and it will throw the above error.

How to solve ASP.NET Validation of viewstate MAC failed

There are several steps or options that you might workaround to solve the issue

  1. Host your site on a server where the application pools never recycle! Obviously, this is impossible.
  2. Disable ViewstateMac by putting this “enableViewStateMac=”false“” in your web.config on Pages tag under system.web tag. Please note that this step is not 100% secure “and NOT recommended”.
  3. Configure ASP.NET to not use Auto-Generated Key but rather a predefined key. This is the perfect and secure method .

To generate your key by yourself use Windows Shell

and then your web.config should like

    
     


    
   
XsoftHost Support

Share

Recent Posts

Add Extra IP addresses to server configuration On Ubuntu 17.10 and later

Each failover IP address will need its own line in the configuration file. The configuration…

3 years ago

Create RAID Arrays with mdadm on Ubuntu

What is mdadm? The mdadm utility can be used to create and manage storage arrays…

4 years ago

How to change the maximum upload file size for PHP

There are several scenarios that you might need to increase or decrease your php maximum…

6 years ago

How to install Let’s Encrypt Plugin in WHM/cPanel

What is Let’s Encrypt? Let’s Encrypt is a free certificate authority provided by the Internet…

6 years ago

How to install python in my cPanel and add py extension

Python normally installed on all cPanel hosting server because most of Centos/red hat update system…

6 years ago

How to install and enable GUI GNOME Desktop on centos 7

Usually CentOS 7 comes in a numbers of variants, For most users, there are two…

6 years ago