Show loginpage if session is expired

In our 4.1 application we have custom settings set that will kill sessions that are no longer used. At this moment the user doesn't notice that his session has been killed untill he tries to perform an action. The problem is that a user then is not logged in anymore and that the log will write errors with nullpointers and such. The user doesn't see any errors but is at that moment redirected to the loginpage. It would be nice that the loginpage is shown at the moment the session is killed. Is this possible to achieve?
1 answers

I would suggest have a microflow which runs on the page through a timer (widget is available) to check and redirect for this.