sessionhttp-redirectuser-interfaceerror-handlingpost-redirect-get

How to display messages to the user after a POST + HTTP redirect


I’m using the PRG pattern to avoid multiple form submission. It has, however, a serious drawback — you cannot simply echo the confirmation message to the user (obviously, the user won’t see the page, he will be redirected to another one).

What are the solutions to this problem? I know two of them, but none of them seems perfect.

Or maybe there are other ways I don’t know about? Some combination of sessions and URL parameters? I don't know.

What’s the best way in your opinion? Which one has the least drawbacks? What are the pros and cons?


Solution

  • Pretty much every website that allows users to log in does so by relying on a cookie. It ain't a perfect solution, but it's the best we got.

    Also session handling is one of those things that a web development framework typically takes care of for you.