ASP.NET Identity 2 relogin after deploy

怎甘沉沦 提交于 2019-12-01 08:08:50

The reason that you have to relogin is because the machine key changes. The machine key encryption is used to encrypt and decrypt the authentication cookie. Since the existing cookie cannot be decrypted the user is deemed unauthorized and needs to login again.

To overcome this you can manually set the machine key in the applications web.config

There is a good online tool by Developer Fusion which can generate these for you. Below is an example of one...

<machineKey 
  validationKey="B4A19ABE93A27433785DD47D6444E4B59394E220641D339AEE453D701F202140FF2BF519CED40335A0563AFB494A48DDF1A8DA00D462B42813712D21342B28C2"
  decryptionKey="2488146C1EA8177EB75422FE6FB6188550EBD0E4B67FCFD33056E50AD9771040"
  validation="SHA1" decryption="AES"

/>

Now everytime you redeploy the keys never change.

Hope this helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!