I suggest you ...

PRG pattern, out-of-the-box support

Built-in support for the PRG (Post, Redirect, Get) pattern. Possibly, through controller action filters ?!, along the the following line: http://weblogs.asp.net/rashid/archive/2009/04/01/asp-net-mvc-best-practices-part-1.aspx#prg

175 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Yitzhak KhabinskyYitzhak Khabinsky shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    Typically in ASP.NET MVC you redirect on success (thus avoiding duplicate post problems) but not on failure. On failure the action handling the post returns the validation errors. Is redirecting on failure and preserving the errors using TempData a common pattern? Is it perhaps even an anti-pattern?

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • ShadowChaserShadowChaser commented  ·   ·  Flag as inappropriate

        Bad idea. At my company, we outright ban TempData and all sessions due to the way our load balancing works in high availability scenarios. TempData is a kludge!

      Feedback and Knowledge Base