I need to able to handle session timeouts nicely from ajax requests. So the user's session has timeout and they should get redirected to the userlogin page if they submit an ajax request.

I just wondering is there anything in the platform that helps out. I want to avoid re-inventing the wheel.


That depends on where the AJAX is coming from. If you're in Visualforce code, you'll get a redirect to the login page, but if you're doing your own AJAX, you'll have to detect the INVALID_SESSION_ID error and perform whatever custom logic you'd like to do. Note that redirecting to a login page will cause your users to lose their view state, so be sure to save it so they can pick up where they left off.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.