Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uses for MachineKey in ASP.NET

What different ways are Machine Keys useful in asp.net? I think the following are correct but thought there may be more.

  1. Multiple applications can use the same cookie
  2. Multiple servers can work with the same viewstate
like image 474
BenMaddox Avatar asked Feb 15 '09 02:02

BenMaddox


People also ask

What is MachineKey used for?

Use the Machine Key feature page to configure hashing and encryption settings used for application services, such as view state, Forms authentication, membership and roles, and anonymous identification. Machine keys are also used to verify out-of-process session state identification.

What is the use of MachineKey in web config?

The MachineKey section can be configured at the machine (Machine. config) or application (Web. config) level and controls the keys and algorithms that are used for Windows Forms authentication, view-state validation, and session-state application isolation.

Is MachineKey protect secure?

This method supersedes the Encode method, which requires the caller to specify whether the plaintext data should be encrypted, signed, or both. The Protect method performs the appropriate operation and securely protects the data.

How do I find the MachineKey for web config?

Open IIS manager. Double-click the Machine Key icon in ASP.NET settings in the middle pane: Now you can click Generate Keys on the right pane to generate random MachineKeys. When you click Apply, all settings will be saved in the web.


1 Answers

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

like image 115
Sergiu Damian Avatar answered Sep 17 '22 21:09

Sergiu Damian