Modify the @ page attribute of the current page and add enableeventvalidation = "false" enableviewstatemac = "false"
Or add <pages enableeventvalidation = "false" enableviewstatemac = "false"/>
If your ASP. NETProgramThis error occurs during execution: "An error occurred while verifying the view status Mac. If this application is hosted by a network farm or cluster, ensure that the <machinekey> Configuration specifies the same validationkey and VerificationAlgorithm. Autogenerate cannot be used in a group. "So it means that you didn't allow your application to use the unified machinekey. What is the role of the machinekey? According to the msdn standard, "The key is configured to encrypt and decrypt Forms authentication cookie data and view status data, it is used to verify the non-process session status identity." That is to say, many ASP. NET encryption relies on values in machinekey, such as Forms authentication cookie and viewstate encryption. By default, Asp. net configuration is dynamically generated by yourself. If a single server is okay, but if multiple servers are load balanced, machinekey is also dynamically generated, if the machinekey values on each server are inconsistent, the encrypted results are inconsistent and the verification and viewstate cannot be shared. Therefore, when Server Load balancer is deployed on multiple servers, you must configure the same machinekey on each site.
Algorithm generated by machinekey:
Validationkey = createkey (20 );
Decryptionkey = createkey (24 );
Protected string createkey (INT Len)
{
Byte [] bytes = new byte [Len];
New rngcryptoserviceprovider (). getbytes (bytes );
Stringbuilder sb = new stringbuilder ();
For (INT I = 0; I <bytes. length; I ++)
{
SB. append (string. Format ("{0: X2}", bytes [I]);
}
Return sb. tostring ();
}
See matchinekey configuration for reference:
<? XML version = "1.0"?>
<Configuration>
<System. Web>
<Machinekey validationkey = "3ff1e929bc0534950b0920a7b59fa698bd02dfe8" decryptionkey = "encrypt" decryption = "3DES" validation = "sha1"/>
</System. Web>
</Configuration>