Warning: session_start(): open(/var/cpanel/php/sessions/alt-php74/sess_e2b72f9c6fade50ec595d3e692bfe2d5, O_RDWR) failed: No such file or directory (2) in /home/xsofthost/public_html/help/wp-content/plugins/accelerated-mobile-pages/includes/redirect.php on line 358

Warning: session_start(): Failed to read session data: files (path: /var/cpanel/php/sessions/alt-php74) in /home/xsofthost/public_html/help/wp-content/plugins/accelerated-mobile-pages/includes/redirect.php on line 358
Validation of viewstate MAC failed On asp.net windows server - XsoftHost

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 <machineKey> 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 .
  4.  

To generate your key by yourself use Windows Shell

and then your web.config should like

				
					<machineKey validationKey=”08CE6B478DCE73……….E566D8AC5D1C045BA60″
decryptionKey=”4252D6B2268………67F451CE65D0F2ABE9BCD3A”
validation=”SHA1″>
</machineKey>

				
			
Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on whatsapp

Related Posts