fixes #6616 CMS does not honor KEEP_SESSION_ALIVE

Fixed the issue and committed the code for review, please check it.