I have a simple JsonResult that right now, whilst I am working it out, takes a value, and returns a struct (as a JsonResult). This part works, in that I have hooked the request up to a button click with jQuery and can read the value back.
My question is, is it possible to add the struct to the context of the page, so that the struct that is generated is available when the form is submitted?
I want to avoid holding the value in a session, and hopefully do it “properly”
Do I need to use a different approach/method than using a JsonResult?
I hope this makes sense?
In my experience, anything sent to the client can be altered before it’s sent back whether you like it or not. Granted, some things are easier to manipulate than others, but it’s still possible.
With that said, it really all depends on how concerned you are with client side changes, and how sensitive the information in this struct is on whether or not you store it client side or server side.
Regardless, it’s fairly simply to store the value client side in a JavaScript variable, or in a hidden field as a string and return it back during a form post or an ajax call later.