Very often, it is because you rebuild the solution. The web server restarts and machineKey
are regenerated.
So the cookie encrypted and signed by previous machineKey
is invalid.
That's why you are forced to log out.
Here is a quick one for you. https://stackoverflow.com/a/436053/280970