Preventing Duplicate Record Insertion on Page Refresh
Date Published: 29 June 2005
Terri Morton has a new article this week on preventing duplicate records from being inserted when a user refreshes a page that does a form POST. Here’s the abstract:
A common concern of ASP.NET developers is, “How do I prevent previously submitted form data from being reinserted into the database when the user presses the browser’s Refresh button?” This article outlines some possible solutions to this problem, highlights what works and what does not work, and then offers a recommended solution.
This is worth a read mainly because of the time it spends on various techniques that do NOT solve the problem. Most web developers have encountered this problem in some form, but there is by no means a de facto standard way to deal with it. Knowing up front what doesn’t work and why not will save a lot of developers some frustration. Terri’s conclusion is spot on as well.
Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.