I am using ASP.NET MVC 3 and I have a C # object that I need to maintain between requests. It supports some server-side status information, which is not very important for this issue. Currently, this object is serialized into a session, and then pulled out for each request.
The problem with this approach is that the object is session specific, but I would like it to be specific to each request. Thus, opening a second tab in your browser will essentially have its own object, rather than sharing the same object as the first tab, because it is the same session.
Therefore, obviously, I need to save this object on the page and pass it back with requests. I am wondering how best to do this. The client does not need information in this object, and the data in this object is not confidential data, so I am not trying to prevent visitors from viewing it. I'm just wondering what is the best way to keep this object between requests. Is there an easy way to serialize a C # object in a view, for example, like in a hidden field (similar to viewstate web forms) and then take it back to each request?
source share