ASP.NET Push Redirect on Session Timeout

Usually, you set the session timeout, and you can additionally add a page header to automatically redirect the current page to a page where you clear the session right before the session timeout. From http://aspalliance.com/1621_Implementing_a_Session_Timeout_Page_in_ASPNET.2 namespace SessionExpirePage { public partial class Secure : System.Web.UI.MasterPage { public int SessionLengthMinutes { get { return Session.Timeout; } } … Read more

Logout/Session timeout catching with spring security

I’ve got a simpler solution. This works for both logout and session timeout. @Component public class LogoutListener implements ApplicationListener<SessionDestroyedEvent> { @Override public void onApplicationEvent(SessionDestroyedEvent event) { List<SecurityContext> lstSecurityContext = event.getSecurityContexts(); UserDetails ud; for (SecurityContext securityContext : lstSecurityContext) { ud = (UserDetails) securityContext.getAuthentication().getPrincipal(); // … } } } web.xml: <listener> <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class> </listener>

How to handle session expiration and ViewExpiredException in JSF 2?

To handle the exception whenever the user invokes a synchronous POST request on a page while the HTTP session has been expired and the JSF view state saving method is set to server, add an <error-page> to the web.xml which catches the JSF ViewExpiredException and shows the home page. <error-page> <exception-type>javax.faces.application.ViewExpiredException</exception-type> <location>/home.xhtml</location> </error-page> To handle … Read more

Session timeout and ViewExpiredException handling on JSF/PrimeFaces ajax request

Exceptions which are thrown during ajax requests have by default totally no feedback in the client side. Only when you run Mojarra with project stage set to Development and use <f:ajax>, then you will get a bare JavaScript alert with the exception type and message. But other than that, and in PrimeFaces, there’s by default … Read more