views:

432

answers:

2

Hello and thanks for your time.

I've spent quite a bit of time searching for an answer to the old question of preventing duplicate posts when the user navigates back, forward, or refreshes the page. I've seen quite a few solutions proposed, none of which are working.

Proposed solution #1) Many people offer ways to instruct the browser to not cache pages, including some books I have. It is often noted that this isn't really a good solution because the user can turn off this feature in their browser, causing it to not honor the request.

Proposed solution #2) In a book I have it proposes that using timestamps set in the Viewstate and Session can detect stale pages. This detection DOES work, but the 'what to do about it' part does not: redirect to the same page, thereby reloading a page in it's pristine state.

I haven't posted any code because I've just gone in circles with many versions.

This is my first visit to this site and hopefully I can find some wonderful advice :)

Again, thank you for your time.

+1  A: 

A solution I have found to be effective is to place a hidden control on the page with GUID value inside. Save the GUID to your database record and then every time the user submits data, make sure the GUID is unique before processing the data.

Chris Pebble
A: 

Ah, so make no attempt to outsmart the browser, but take the defensive position of protecting the data. I'll try this when I get home. I like the idea because it's 'future proof'.

Thanks :)

kmyers