I have this in my web.config:
<sessionState timeout="70"/>
and:
<authentication mode="Forms">
<forms loginUrl="~/Index" timeout="60" />
</authentication>
I also have this:
Session.Timeout = 70;
So, after an hour or so, the user is still logged in, but the session is null and my program crashes. Any idea?
Actually the code in the question is correct. However, everytime I rebuild my code, the session was lost. That was the problem.