How to solve Mac verification failures on ASP.net Virtual Hosts

Source: Internet
Author: User

Error:
"/" Application Program Server error.
--------------------------------------------------------------------------------

An error occurred while verifying the view status Mac. If this application is hosted by a network farm or cluster, make sure that the <machinekey> Configuration specifies the same validationkey and VerificationAlgorithm. Autogenerate cannot be used in a group.

Note:An error occurred while executing the current Web request. Check the stack trace information to learn about this error andCodeDetailed information about the cause of the error.

Exception details:System. Web. httpexception: An error occurred while verifying the view status Mac. If this application is hosted by a network farm or cluster, make sure that the <machinekey> Configuration specifies the same validationkey and verification algorithm. Autogenerate cannot be used in a group.

Source error:

This exception is generated only when compilation is performed in debug mode.Source code. To enable this feature, Perform one of the following steps and request the URL:

1. Add a "DEBUG = true" command at the top of the file that generated the error. For example:

<% @ Page Language = "C #" DEBUG = "true" %>

Or:

2. Add the following section to the application configuration file:

<Configuration>
<System. Web>
<Compilation DEBUG = "true"/>
</System. Web>
</Configuration>

Note that the second step will compile all the files in the given application in debug mode. The first step will only compile the specific file in debug mode.

Important: running an application in debug mode will produce memory/performance system overhead. Before deploying a production solution, make sure that application debugging is disabled.

Solution:Because. in the process of transmitting client data and servers, you must encrypt and decrypt the data. config. in config, the default values of validationkey and decryptionkey are autogenerate, which are randomly generated by the system. If you are local or using an independent host, there is usually no problem, but the virtual host is used, when multiple virtual hosts exist on one server, the above problems may occur. msdn also pointed out that autogenerate cannot be used in the cluster to specify a fixed key value, which needs to be stored on the web. add the machinekey configuration item in config and manually set the key value. Note that the maximum length of the key varies with different encryption algorithms, here we can use AES, Des, 3DES, sha1, MD5. I only know that the key character length of DES is 16, and the length of 3DES is 48, when you manually set the key length, it must be equal to its maximum length. Otherwise, an error occurs! You can enter the hexadecimal value of the key.

The procedure is as follows:

Find the Web. config file under the root directory of the website running, and add the corresponding items as shown in the highlighted line. When setting, modify the key value by yourself, which is related to the server's encryption security. If the image cannot be seen clearly, click the image to view it.

Code: <machinekey validation = "sha1" validationkey = "cipher" decryptionkey = "5fc88dfc24ae12bc"/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.