tags:

views:

22

answers:

1

When user posts back a web form and then tries to refresh the page - dialog "would you like to resend information" pops up (Opera works silently though). To avoid this we can redirect browser to the page we'd like to show after postback. Now, when user refreshes the page, he duplicates get-request and no pop-ups.

Everything is ok but post/redirect/get approach requires additional roundtrip. Is there better alternatives. Send form data with ajax aynchronously, for example?

Thank you in advance!

A: 

I think you'll have a much tougher time making an AJAX-based solution survive a page refresh and browser history navigation. Once you get past a certain level of complexity, there's far too much state to manage.

The PRG pattern solves some basic usability issues for which the overhead is minimal, remember your POST response will have no body content. If you're reusing your HTTP connections (Persistent HTTP/Keep-Alive), then there's very little to worry about.

Lee Kowalkowski