Is there a way to identify The page you submitted was invalid for your session errors in visualforce page or controller?

I currently have an error handler page, which will notify users to try again when an exception has occurred (a friendly message). But users get the same message even when session has expired, so would like to handle such exceptions separately - will notify users about session expiry instead of the standard message.

1 Answer 1


There's no way to know for sure if the session has expired, nor can you catch the exception when it occurs (because your Apex Code will never be called in that case). For now, the two solutions are either (a) training (tell the users about how to handle it), or (b) implement a "keep alive" method, such as by using an apex:actionPoller that refreshes the session every 10 minutes (warning: this will allow users to stay logged in indefinitely while their browser remains on this page). At the moment, unless you implement a client-side storage mechanism or progressive saving, an unrecoverable error, such as an invalid session, will result in total loss of all of the user's input.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .