防止asp.net mvc

时间:2016-11-18 10:01:23

标签: asp.net-mvc session

在我的应用程序中,我使用了几个会话变量,但在web.config中没有给出任何会话超时。我在web.config中使用了身份验证模式为none。 但是在一些不活动时间之后,它会退出并重定向到登录页面。它应该保留,并且所有操作都应该保持原样,即使我将它保持活动数小时(例如GMail,直到我们点击注销它将在那里)。请协助我解决这个不活动会话问题。在我明确点击" LogOut"

之前,它不应该松开任何会话和操作

1 个答案:

答案 0 :(得分:0)

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.