views:

172

answers:

2

Is there any way to listen to a logging out event in SharePoint? We have event listeners when a list is created, so that got me thinking if there is one which will tell me if a user is logging out of the system or not.

Thanks for your time.

+1  A: 

if the user manually logs out, you can hook code in the 12/TEMPLATE/Layouts/logout.aspx page. There is no (default) session in SharePoint and it would usually be persisted in SQL Server (SQL Server persistence has no Session_End event).

In the end, most people would have some sort of job that checks activity, you could store in-memory info creating cache keys with the usernames and create a similar type of session management and run your code on the callback for the cache expiration.

F.Aquino
I have been following the logic of storing username in the cache with timed expiration and monitoring the activity, it works great.
Kusek
I don't think it's a good idea to change logout.aspx in anyway since it can be updated by MS at any time. I think modifying pages under the layouts directory is not supported by MS. @kusek - I don't think I can trust the cache object since it can be cleared anytime?
iHeartDucks
@iHeartDucks : Yes Any modification to out of the box SharePoint files is not supported by MS, but you can always copy the file and modify it.With regard to Cache you can hook up an event that gets fired when a item is removed from cache.That way you will have the hold.
Kusek
+1  A: 

here is also another alternative.

http://blogs.msdn.com/pranab/archive/2007/12/13/using-http-module-for-sharepoint-2007-moss-wss-site-using-fba-and-rsa.aspx which seems to be alot less intrusive

Brian Brinley