0

I have gone through several article with the caption mentioned as in header, most of them discussed about the implemenation of it in ASP.NET instead of ASP.NET MVC.One of the better article i read was ASP.NET MVC - How To Show A Popup Warning Before Session Timeout , but was using third party control

I have some queries about the implementation of session timeout.

  1. How can I Implement the above mentioned scenario (using Jquery Timeout Control)??
  2. Where should I write the code so that it is accessible everywhere in the page?
  3. If an user wishes to stay on the current page, how to perform this scenario without refreshing the page(refresh means all data is lost if the user is filling a form)
ksg
  • 3,927
  • 7
  • 51
  • 97

1 Answers1

0

The documentation seems self explanatory. Anyways, check this out.

The link above answers your 2nd question.

regarding 3rd, make use of keep_alive_url in timeoutDialog() constructor.

Update:-

If you want to go with jQuery only, check this out.

For a plain js solution, check this.

Alternatively, check this out for the implementation that you started with.

Community
  • 1
  • 1
Sudhansu Choudhary
  • 3,322
  • 3
  • 19
  • 30
  • Can you kindly explain `second query`. How can I dynamically call the event when session expires.. – ksg Nov 17 '15 at 11:39
  • As I understand, you can set the timeout session attribute to the required amount of time in the Web.config file. The same amount of time could be set for `countdown` property in `timeoutDialog()`. Generally these session timeout implementation start if there is no activity on page. Is this how things should behave for you as well? – Sudhansu Choudhary Nov 17 '15 at 13:36
  • Yes..also is there an event named `window.sessiontimeout` in javascript.I read about this in the above mentioned tutorial. – ksg Nov 19 '15 at 11:41
  • Hi @ksg sorry for late reply... guess what you need is http://stackoverflow.com/questions/23023916/javascript-auto-logout-code#answer-23024313 check out the explanation of the question and the answer. I feel thats what you need. As a matter of fact I've used http://stackoverflow.com/questions/23023916/javascript-auto-logout-code#answer-23024313 in my app. Works like a charm. The first link in this comment should do the work for you. have edited my answer. – Sudhansu Choudhary Nov 20 '15 at 08:05
  • One more thing, `window.SessionTimeout` is not an event in native js, it's just a custom function expression that the blogger has provided. Check http://stackoverflow.com/questions/23704797/pass-window-sessiontimeout-script-to-js-file too. – Sudhansu Choudhary Nov 20 '15 at 08:12