如何保持用户登录? [英] how to keep user logged ?

查看:82
本文介绍了如何保持用户登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我创建了一个登录表单
并在会话中保存信息

但我不能让用户长时间登录

有没有办法解决这个问题?

我的意思是,如何让用户一直保持登录状态,直到他登录
ged out

Hello,

I created a log in form
and save information in sessions

but I can''t keep the user logged in for a long time

is there a way to deal with this issue ?

I mean, how can I keep user logged in all time, till he log
ged out

推荐答案

会话将在预设时间后到期-如果您在会话中存储登录信息,则此时用户将被注销(此操作用户每次发回网站时,时间都会重置)
您可以更改此超时计时器,但是您不应将其从默认的二十分钟延长,因为它会为每个会话使用内存: ^ ]

相反,您是否考虑过将信息存储在Cookie中-cookie设置为在关闭浏览器实例时失效?
The session will expire after a preset time - if you are storing login information in the session, then at that point the user will be logged out (this time is reset each time the user posts back to the site)
You can change this timeout timer, but you should not extend it from it''s default of twenty minutes, as it uses memory for each session: http://msdn.microsoft.com/en-us/library/ms525473(v=vs.90).aspx[^]

Instead, have you considered storing the info in a Cookie - the cookie set to expire when the browser instance is closed?


在登录时,在另一页面加载时使session.count = 1 ...
而每当您要注销时,请计数0 ...

如果有任何问题,那就让我一切都好...
At login time, on another page load make your session.count=1...
and whenever you wants to log out make count 0...

if there is any problem then let me know ok all the best...


这篇关于如何保持用户登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆