function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
The KnightThe Knight 

Session invalid message is seen on visualforce page

When the session expires and the visualforce page tries to reload.  I am getting the following message on visualforce page.

"Session Invalid The session in this window has become invalid.
Did you login again from another window?
Please reload the page in this window to refresh the session."


I did not login to anyother org.


I don't want to show this error on visualforce page. How can this be avioded?

If this cannot be avoided. I want to redirect the user to the login page. Can this be achieved?


Any help would be appreciated.

Thanks in Advance.





if your session id is not valid and you want to redirect to the login page :


suppose your url is :


just redirect to : and the login page will appear.

The KnightThe Knight

The question is how will I come to know that my session is Invalid?


try using : UserInfo.getSessionId() and see if it returns you something or with : API.Session_ID and see what is return