Session timeout and Logout event

Hi Demis.

I have done it how you tell and have saved it with separately Id sasions:

I close sessions in this instructin by timeout, but during closing session doesn’t enter into Logout and I can’t clear a cache:

Can you tell how can I catch an event?

Sorry for mistakes :blush:

The logout event is for when users explicitly logout.

There is no event you can catch and no callback is possible for Session Timeouts which happens when the Caching provider transparently expires the cache entries.

Would a timer based on the session expiration during the Authenticate method be roughly appropriate?

For instance, in my authenticate, I’m saving the session with a new SessionExpiry

authService.SaveSession(session, SessionExpiry);

I could set a timer to fire just before the expiration would occur and then call Logout. Any reason why that would fail?

That’s very fragile, a Timer requires a background thread which you wouldn’t want to create for every session and wouldn’t work beyond App Domain restarts.