Hello, I have a question:
How could I handle the session expire on a MVC application that has JQuery Ajax method calls on certain pages. The issue is the following:
- When the client reaches the session timeout, each of my controllers inherits a class that checks if the session is alive (looking up on some stuff like the site session, database session, etc) and redirects the client to a new page saying that the session expires; but the case is different when I'm using JQuery ajax to call methods of the controllers on some button clicks, cause it skips the validation of the inherited class and allows me to stay on the page, but when the controller tries to end the execution of method, obviously it throws .Net errors: objects are not created as instance of objects, Session variables not found, etc.. all because of the expired session that was not handled because of the asynchronic method call.
How could I handle this behaviour, and which is the best way to handle it (trying as much as possible to not modify so much parts of the code of the application)?
Thanks in advance.
PD: It might be useful to tell that I'm using $.post()
from Jquery.