How do I expire a PHP session after 30 minutes?

You should implement a session timeout of your own. Both options mentioned by others (session.gc_maxlifetime and session.cookie_lifetime) are not reliable. I’ll explain the reasons for that. First: session.gc_maxlifetimesession.gc_maxlifetime specifies the number of seconds after which data will be seen as ‘garbage’ and cleaned up. Garbage collection occurs during session start. But the garbage collector is … Read more

How to declare session variable in C#?

newSession is a poor name for a Session variable. However, you just have to use the indexer as you’ve already done. If you want to improve readability you could use a property instead which can even be static. Then you can access it on the first page from the second page without an instance of it. page 1 … Read more

Session timeout in ASP.NET

I am running an ASP.NET 2.0 application in IIS 6.0. I want session timeout to be 60 minutes rather than the default 20 minutes. I have done the following Set <sessionState timeout=”60″></sessionState> in web.config. Set session timeout to 60 minutes in IIS manager/Web site properties/ASP.NET configuration settings. Set idle timeout to 60 minutes in application pool properties/performance. I … Read more

How to fix org.hibernate.LazyInitializationException – could not initialize proxy – no Session

What is wrong here is that your session management configuration is set to close session when you commit transaction. Check if you have something like: in your configuration. In order to overcome this problem you could change the configuration of session factory or open another session and only than ask for those lazy loaded objects. … Read more

Cookies vs. sessions

The concept is storing persistent data across page loads for a web visitor. Cookies store it directly on the client. Sessions use a cookie as a key of sorts, to associate with the data that is stored on the server side. It is preferred to use sessions because the actual values are hidden from the … Read more