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:

  1. there's been no activity user (mouse clicks or mouse move) and,
  2. if there hasn't, checks see if 5 minutes (or rather 4 minutes 30 seconds) has elapsed. if has then,
  3. 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

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -