jquery - Does XmlHTTPRequest/AJAX request on Asp.net MVC controller update session timeout -
scenario
we have auto logout feature activates timeout window after 4 minutes or so. timeout value retrieved formsauthentication element of authentication configuration in web.config file. e.g.:
<authentication mode="forms"> <forms loginurl="~/account/login" timeout="5" /> </authentication>
the javascript code has timer fires every second checking see if:
- there's been no activity user (mouse clicks or mouse move) and,
- if there hasn't, checks see if 5 minutes (or rather 4 minutes 30 seconds) has elapsed. if has then,
- it shows popup counting down 30 seconds lets user either click continue stop auto logout or if left untouched automatically logs user out , redirects them login page.
here's example of code runs on client side extend session:
$.ajax({ type: "get", url: alchemy.rootpath + "account/timeoutextend" });
the controller action being called nothing:
public actionresult timeoutextend() { return (viewbag.none); }
the problem
at moment when leave popup run down 5 seconds , click button continue session, user logged out anyway.
seems come server's side rather on client side.
question
is possible xmlhttprequest ajax requests mvc controller, used extend user's session, in fact not extending session because somehow mvc treating ajax request differently?
i think session not extended in mvc in 1 of below 2 scenarios
1) request sent cross domain request (cors)
2) somehow user information (session cookie) not sent server along ajax call
Comments
Post a Comment