I need to show a session expiry message on login screen if the session is expired.
Suppose user is on homepage after login. He kept open the page for a long time without any activity on the page. In the meantime if the session is expired and user refreshes the page, it should redirect to login page and a message should be displayed at login page "Your session is expired. Please login again". But if the user closes the browser when the session has expired and opens the login page in new browser window, then at time message should not be shown.
So how can I identify that session is expired and user has refreshes the page.