After brief research, I've found in one of SO thread that there are three most popular ways of storing information between requests in ASP.NET MVC:
- Storing information in form fields in the view, and post it back to the controller later
- Persisting it in some kind of storage, e.g. a file or a database
- Storing it in server memory by acessing objects that lives throughout requests, e.g. session variables
How does the first method work? I mean, I can have a controller that returns a view + viewmodel accessible from this view. The user does something in the view and request an action from the server. Now, the action will perform on server side and it will return another view. So anything I store in the HTML form fields will be gone after requesting any action from the server.
I guess the only way is to POST form fields to the server and then send it back with the returned View. If I don't post them from the view, the modelview object data are gone. Or maybe there's another way I'm not aware of?