Sitefinity
Logout Event

Mar 27

Introduction

Recently I had a need to perform some actions after a user had logged out of Sitefinity. Checking the Sitefinity Event Hub list of events I noticed that this event didn't exist. I decided to go looking to see if I could find a way to handle the event and to my surprise I found an undocumented feature.

For your reference, here is the documentation of the events you can subscribe to.

I used Just Decompile to look through the existing events and as well as a search on terms such as 'Logout' to find a place I may be able to hook into. Through this process I was surprised to find under the 'SecuirtyManager' class the method, 'RaiseLogoutEvent' which called 'LogoutCompletedEvent' under the 'Telerik.Sitefinity.Web.Events' class.

So a simple registration of,

EventHub.Subscribe<ILogoutCompletedEvent>(UserLogout.Completed);

and I have access to the user who is logging out and their IP address.

I can't say why this is not listed in the documentation. I have raised it so maybe it will turn up one day. In the meantime at least you now know it does exist.


Darrin Robertson - Sitefinity Developer

Thanks for reading and feel free to comment - Darrin Robertson

If I was really helpful and you would buy me a coffee if you could, yay! You can.


Leave a comment
Load more comments

Make a Comment

recapcha code