R – Good ASP.NET MVC pattern for form submit and immediate result display


I hear everyone recommends redirecting the user (HTTP GET) after he submits the form (HTTP POST). It's clean, there is no "do you want to resend" alert, it's simple…

But, what if I want to show some result to the user?

Okay, I can add some parameter to the GET url, like "/?message=1" and then check for that parameter.orm

But, what if I want to show more information? For example, the user submits the form, and the result is a simple structure with let's say… 5 different properties that I want to show to the user.

Something like, "You added a product to the cart, and here are 5 other products that others added as well.". Now, this is simplified, don't tell me "Ah, just pass ?productId=xy and then do another query based on that ID".

Should I maybe stick with POSTBACK model?

Assume the user is anonymous AND without cookies enabled.

Best Solution

That's what TempData is for. It is specifically, and only, for the case where you are redirecting. Use it just like ViewData, except that it will survive a redirect.