Server configuration, configuring machinekey when load balancing is required

Source: Internet
Author: User

Server configuration, configuring MachineKey54018922 when load balancing is required

Why machinekey in an ASP. How do I generate machinekey?

If your ASP. NET program executes this error: "Verify view state MAC failed. If this application is hosted by a network farm or cluster, make sure that the configuration specifies the same validationkey and validation algorithms. You cannot use AutoGenerate in a cluster. "So what does machinekey do if you don't let your application use a unified machinekey?" As the MSDN Standard says, "Configure the key so that it can be used to encrypt and decrypt Forms authentication Cookie data and view state data and use it to authenticate the out-of-process session state identity." "This means that many of the encryption in ASP is dependent on the value inside the machinekey, such as the Forms authentication Cookie, ViewState encryption. By default, The configuration of the ASP is self-generated, if a single server is certainly not a problem, but if more than one server load balancing, machinekey also adopt dynamic generation, each server machinekey value inconsistent, resulting in encryption results are not consistent, can not share authentication and viewstate, the For multiple server load balancing scenarios, be sure to configure the same machinekey at each site.
The webconfig needs to be configured as follows:

<machineKey validationKey="9912131415161718190a0b0c0d0e0f1011987654" decryptionKey="99225577bbaa9988" validation="SHA1" />

Eggs

C # Determines whether the current computer is connected to the network
//判断网络连接         [DllImport("wininet")]        private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);             private void btnOK_Click(object sender, EventArgs e)        {            //判断是否联网             int i = 0;            if (InternetGetConnectedState(out i, 0))            {                //联网                MessageBox.Show("Thylx提醒您:你的计算机已连接到网络上!");            }            else            {                //断网                MessageBox.Show("Thylx提醒您:本地连接已断开!");            }        }
How Web projects know which mailboxes to send to others to see if they read the message

When we do Web projects, will often encounter the issue of e-mail to the user, how to judge the user to read the mail, you can use a method, is to send a message in the HTML to use the image loading method, upload to the system to deal with

Server configuration, configuring machinekey when load balancing is required

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.