I'm using asp.net mvc 5 together with Identity2, standard login/password authentication, with "remember me" checkbox.
Imagine the scenario:
Questions:
All these happens when deployed to IIS7, locally on IIS Express everything is ok.
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.