AJAX Timeout Session Response

In my application, I load a table using AJAX. But when the user session is played out, it gives me the login page as an answer, which is loaded into the table area.

I want to redirect to the login page, maybe in javascript, when the session timeout occurs during an AJAX call.

+6
javascript ajax session
source share
2 answers

When rendering the login page, you can add your own HTTP header: X-LOGIN-PAGE: True . Then make an AJAX call and check for the presence of this custom header in the callback. Act accordingly, if any.

+5
source share

You can authenticate with the method called by the AJAX call, and if it is not found, you can simply return the flag. In the AJAX handler on the client page, you can detect and redirect to the login page.

0
source share

All Articles