How To Generate Machine Key In IIS
Machine Key Protects Cookie Data of Forms Authentication and Page Level View State Data.
Machine Key validate Out Of Process Session State Identification
Session State may be SQLServer or StateServer SessionStateMode.
SessionStateMode - Indicates where to store the Session State Values.
This mode can be of Four Types(Custom, InProc, Off, SQLServer, StateServer).
Mainly there are two types of Machine Keys. 1. Validation Key 2. Decryption Key
Importance of Validation Key - It mainly confirms the integrity of data by computing
the message authentication code.
The key is either stored in Authentication Cookie of Forms or on View State of each page.
Importance of Decryption Key - It is mainly used for encrypting and decrypting data like
view state and authentication Cookie of page.
On IIS, click on your website. On Features View double click on the
Machine Key Icon as shown in the figure.
Then click on Generate Key on the right panel as shown in the figure.
New Validation Key and Decryption Key will be produced on the respective
textboxes as shown in the figure.
Save the Machine Key details and write the following code on the
web.config of your Asp.Net application as shown in the figure.
By this way we can generate Machine Key in IIS for Asp.Net Application.