Simulate session time out

Hello,

I have a webapplication with forms authentication and cookies. I want to do some automatic tests. One of the tests I want to perform is to test a session timeout. However I don't want to wait until the timeout period expires, but want to do an action to simulate the timeout. I thought a way to do that is to change the value of the session cookie. Is that a correct test to simulate a timeout? If negative, is there another way to do that?

Regards,

Arne
adiemeerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
I don't think that will work.  And you may find it difficult to test.  Session expiration is controlled by the server and is a minimum time, not an exact time, so you can't use it as a timer.  And session expiration is only checked when you access a page that is part of the session.  I know that in PHP, if you never again access a page with that session, the session data may never get removed.  Also, if you completely close your browser and re-open it, all 'session cookies' will be deleted.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
How the session works:
http://www.experts-exchange.com/articles/11909/PHP-Sessions-Simpler-Than-You-May-Think.html

The session "timeout" occurs as a result of garbage collection.  When a client has not touched the session data via an HTTP request in more than 24 minutes, the session data becomes eligible for garbage collection.  Whether garbage collection actually occurs (and whether the timeout is really 24 minutes) are subject to configuration variables.

If you read the article and still wonder how to test this, please post back and I'll try to help.  But I agree with Dave Baldwin - if you want the session to go away, just close the browser.  You will have to close every instance of the browser to ensure that the cookie is no longer returned.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.