Reputation: 583
I have an ajax request that is firing every n number of seconds... as such the ASP.net session timeout never happens.
Can I manipulate the ajax request somehow so that the asp.net session is not kept alive by virtue of this ajax request firing off in the background?
Basically, let the session die!
Cheers for any input or point in the right direction!
Andrew
Upvotes: 2
Views: 1200
Reputation: 4864
Use setTimeout function to do this
var timeoutID;
function delayedAlert() {
timeoutID =window.setTimeout(slowAlert, 25000);//Session Timeout to expire in milliseconds
}
function slowAlert() {
$.ajax({
});// call Ajax function to clear all sessions.
}
If you have other ajax requests in the same page and want to keep the session active for those requests. Please clear timeout function before that.
function clearAlert() {
window.clearTimeout(timeoutID);
}
You can call the delayedAlert
function in window.load function itself. (or $.ready())
Upvotes: 1