Link to home
Start Free TrialLog in
Avatar of Josh_Blade
Josh_Blade

asked on

How to timeout an active session in C# .NET

I'd like to set our active sessions to timeout after 12 hours. I already have an idle timeout set up, but I'm curious how to set a timeout for an active session.
Avatar of strickdd
strickdd
Flag of United States of America image

Set a cookie at the beginning of the session and set an expiration of 12 hours. Check that cookie every postback and if it doesn't exist, call Session.Abandon(). That will clear the session and force the session start to occur again and a new cookie to be created.
ASKER CERTIFIED SOLUTION
Avatar of Easwaran Paramasivam
Easwaran Paramasivam
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Response.AddHeader("Refresh", Session.Timeout + ";URL=Logoff.htm");
Avatar of Josh_Blade
Josh_Blade

ASKER

Thanks a lot.