Session Timeout

Apr 14, 2008 at 8:33 AM
Edited Apr 14, 2008 at 9:27 AM
Hi guys,

I know this isn't directly a WCSF question but more a best practice one.
I was wondering if anyone has a "best" practice on how to handle a session timeout for a callback? For example: The session has timed out and a user clicks something that causes a callback. This will end up "hanging" the application.

Any good suggestions?

Br, Christoffer
Apr 16, 2008 at 5:27 PM
Hi,

You may set a Cookie when the Session starts with a custom value to know whether the user has logged out or its session has timed out. Then add this cookie to the Context.Response.Cookies collection and check it in the Context.Request.Cookies collection and verify if the session is a new one at the Application_BeginRequest(object sender, EventArgs e) event handler of a custom HttpModule.

It is not recommendable to check at the Session_End(object sender, EventArgs e) event handler as the previous objects are not available.

Ignacio Baumann Fonay
http://staff.southworks.net/blogs/ibaumann/