Uses for MachineKey in ASP.NET

Uses for MachineKey in ASP.NET

回答1

MachineKey is used for:

  • ViewState encryption and validation
  • Forms Authentication (or Federated Authentication) uses this key for signing the authentication ticket

Having a Web App installed on multiple servers requires same Machine Key configured on all of them in order for Load Balancing to work.

To see all details, please refer to: MSDN How To: Configure MachineKey in ASP.NET 2.0

 

回答2

Machine key is also used to encrypt/decrypt the webresources.axd parameters.

Even on a single server the machine key should be configured, because any recycle of the app domain will generate a new key when it is set to auto. This causes the next postback just for pages rendered before the recycle, to cause a viewstate validation error, and also issues with the resources during that time.

 

posted @ 2021-06-17 09:45  ChuckLu  阅读(92)  评论(0编辑  收藏  举报