Register the call in the appframework before the session is closed

Since the appframework automatically closes the session it's not possible to register the call after the controller has finished.

To test: try to open a password protected public share in a private browsing session (to ensure we have a clean session)

cc @DeepDiver1975 @LukasReschke @Raydiation