Search code examples
c#asp.net-mvctypescriptserenity-platform

Session not ended in Serenity Platform


I've noticed that the session is never ended in Serenity Platform, how I can end the session after 1 hour of inactivity or when closing the browser?

Thanks


Solution

  • Serenity doesn't use session. It only uses Forms Authentication Cookie in non-persistent mode that means it will expire as soon as browser is closed.

    Problem you are having is related to restore last pages feature of Chrome and other browsers. You need to turn it off, otherwise browser will persist even non-persistent cookies.

    Another possibility is Chrome is running in background while you think it is closed.

    Also try lowering the timeout value in web.config:

    <forms loginUrl="~/Account/Login" timeout="30" path="/"
    slidingExpiration="true" />
    

    By default it has 2880 timeout value, which means about 50 hours. It might seem long but it should expire as soon as browser is closed, though unfortunately it doesn't apply because of that browser feature.

    So this problem is not specific to Serenity. You might have same problem with any application that uses cookies and browser with a restore my last pages feature.