views:

47

answers:

2

I've been doing web development for a while and have yet to read a good answer to this question:

Given a page that executes transactions through a postback, how do you prevent the user from duplicating the transaction when they do something as simple as hit the back button? I've explored trying expire the cache but I must admit I'm lacking in my understanding of ASP.NET caching. What is the approach I should use to make the old request stale and invalid? Thanks!

+1  A: 

It's called Post/Redirect/Get.

In ASP.Net, you don't have to do this religiously because many of your postbacks don't actually create transactions. But whenever you do create a transaction of some kind, make sure you redirect to a new page.

Joel Coehoorn
A: 

Check out Response.Expires

http://msdn.microsoft.com/en-us/library/ms525906.aspx

Brian