简体   繁体   中英

prevent inactivity logout in asp.net mvc

In my application I have used several session variables, but not given any session timeout in web.config. I have used authentication mode as none in web.config. But after some inactivity time, its logging out and redirecting to login page. It should remain and all operations should carry as it is even though I kept it inactive for hours (like GMail, until we click logout it will be there). Please assist me in resolving this inactivity session out issue. It should not loose any sessions and operations should carry until I click explicitly "LogOut"

Best approach to handle this is,

Save user session on the database and store session token in a COOKIE which will never expire (You have set cookie expiry as never expire)

That saved cookie and session data on database will be removed when user is logout (You have modify logout code to remove those).

As well as, if user clears all saved cookies on the web browser then, that saved session no longer valid and user will have to login again to your system again. That is a obvious thing

FYI: This is the way exactly to enable Remember me feature.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM