Page expiration after postback in ASP.NET
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 expir开发者_如何学JAVAe 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!
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.
Check out Response.Expires
http://msdn.microsoft.com/en-us/library/ms525906.aspx
精彩评论