Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I searched in many sites but i could not find correct solution for my question.


Q)How to keep session of my site alive for a long time or user can not be kicked out of from my site until he do logout manually.

I know that we can change value in web.config and in iis at hosting server.
but i am not sure whether it is good or not.

please give a better solution or sample code.



Thanks,
chaitanya
Posted
Updated 9-Mar-12 0:24am
v2
Comments
venkata chaitanya 14-Mar-12 8:05am    
In gmail we wont get log out until we do it manually.
in the same way,my users also should not log out until he do it manually..
i have changed the session time out value to 120 minutes in web.config and in iis too.

but my problem has not solved..it is log out automatically for a half an hour

1 solution

You can change it at the server via web.config, but it is a very, very bad idea.
XML
<configuration>
  <system.web>
     <sessionState timeout="20"></sessionState>
  </system.web>
</configuration>

However, this will tie up server resources until the session ends, which may reduce the number of users you can support, or badly affect the response time to users.

Think what would happen if you do set the session so that it lasts until the user logs off. What would happen if the user doesn't log off, but gets disconnected, say? The resources are still tied up at the server...

Instead, think about using cookies instead of session variables - they are intended to be persistent, which sessions aren't.
 
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