I've always wondered why many web frameworks have an elaborate "session management" feature. What would you store in such a session other than a CSRF token and user id?

(And, technically, you don't even need to store a CSRF token, that could just as easily be derived from the session id)

- UI lanugage preference
- shopping cart
- content of the partially filled form

The last one is useful in this weird usecase, where you have form A, which has a selectbox. But sometimes what you want to select isn't available in the selectbox, so there's an "add sth that's not on the list" button next to the selectbox. That button gets you to form B. Once you're done with form B, you click submit, the thing is added, and you're redirected back to form A, so you can continue filling it out.

But how does the backend store the partially filled out form A, so that you don't have to start over when you return to it? In the session.

@Wolf480pl I'm not sure language preference should be tied to a session, I'd throw it in a separate cookie with long expiration time.

The other two make sense, though in your last example I'd just open the new form in a new tab/window. Maybe not as intuitive for computer-illiterates, but less surpising behavior IMO (hidden state often surprises me, at least)

Sign in to participate in the conversation

Welcome to your niu world ! We are a cute and loving international community O(≧▽≦)O !