Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
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
Posted
Comments
[no name] 9-Jul-12 12:00pm    
What is your session timeout? Why do you think that your user is not logged in? Define "long time".
Sandeep Mewara 9-Jul-12 12:03pm    
+1

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?
 
Share this answer
 
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...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900