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.
Josh_BladeAsked:
Who is Participating?
 
strickddCommented:
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.
0
 
nishant joshiTechnology Development ConsultantCommented:
Response.AddHeader("Refresh", Session.Timeout + ";URL=Logoff.htm");
0
 
Josh_BladeAuthor Commented:
Thanks a lot.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.