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