MVC - where to save the session data?

Camillia
Camillia used Ask the Experts™
on
This guy on our team is working on a form application. Lots of fields in this form. Employee info, address, stuff.

He doesn't have "you're timing out" popup.  As user goes from page to page, he does NOT save the information in database. He saves the fields data user populates in  server session

So, user times out and they don't know they've timed out... user clicks to another page after 20 mins whatever and they've lost their data.

Solutions
1. My manager says to use the browser session to store the data until user clicks submit
2. Developer says he can extend the session timeout but he says this will affect all users and will take up resources. He says at most..5 people are using this application but has lots of fields for user to populate

3.  He says he can have "you're timing out" popup but even if he does....and user times out... the data is gone, no?

4. We can't have viewstate (my manager mentioned this)....this is MVC

5. I say at each step, when user clicks "Next"... data should be saved in a temp table in the database. User logs back and can pick up where they left off.


What should we do? use browser session? save in DB?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
1. Like just in the page itself? Or in something like local storage (or heaven forbid, a cookie)?

2. Sure it will take up resources. Will it negatively affect users? Are we talking like 50,000 fields per user? It's doubtful that 10 - 20 fields will result in a significant performance issue...unless your server is woefully under spec'd.

3. Well yeah. That's what happens when the session times out. You can prolong this by pinging the session every so often, since session has a sliding timeout.

4. No, and why on earth would you?

5. You certainly could. You can even have session state itself stored in a database. Obviously this is slower since there's a database call. But it can also be scalable if you end up in a load-balanced web server layout.
#1 . I think my manager meant in the page itself. If we want to save in a local storage...what are our options?
Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015
Commented:
Not sure what you mean by "options". Local storage is an HTML 5/Javascript API. There's also "session storage" that's a part of that API. The difference being:  local persists until manually deleted; session persists for life of browser tab.

https://caniuse.com/#feat=namevalue-storage

If memory serves, there is a size limitation of how much you can store in either of those, but it's MB worth of data.
let me see
thanks, passed on the info.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial