Machine Key for ASP.NET core applications in Webfarm

     

Scenario:

MVC issue with 'The antiforgery token could not be decrypted' in web farm.

Solution:

Generate a machine key and use the same key in web.config across all instances in the web farm

1. IIS Management console
2. Go to your site -> Machine Key -> Generate Keys -> Apply
    a. Validation method = "SHA1"
b. Encryption Method = "AES"
3. The machine key would be saved to the web.config file as below

    <machineKey  
        validationKey="WDFDSFSDFSDF23423423423423WEREWRWERWEREWREW9F67897SDFDS89F7SD89F78SD97F98S7D89F7SD98F7SD98F7S9D"           
        decryptionKey="FSDGSDGSDFG6767FDSGFGFDGFDG78FD7G97FD98G"
        validation="SHA1"
        decryption="AES"
    />

No comments:

Post a Comment

Move Github Sub Repository back to main repo

 -- delete .gitmodules git rm --cached MyProject/Core git commit -m 'Remove myproject_core submodule' rm -rf MyProject/Core git remo...